Jump to content

enable/disable sort header column menu in uniDBGrid


bruno65

Recommended Posts

Hi,

i tried to enable/disable sort header column menu in uniDBGrid with adding a checkbox named "Tri". For that i added a client event

function beforerender(sender, eOpts)
{
   var currentHeaders = this.headerCt.getMenu(); 
   
   // ajoute le menu pour le tri et le filtre
   currentHeaders.add(
      [
         {
            itemId: 'checkSortMenuItem',
            text: 'Tri', 
            checked: false, 
            handler: function() {
              currentHeaders.hide(true);
              ajaxRequest(sender, 'OnTriChange', ['checked='+this.checked.toString()]);
            }
         }
      ]
   );
}

and a server event 

procedure TMainForm.IUMGrid1AjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
var
  ShowFilter: Boolean;
  ShowSortOrder: Boolean;
  I: Integer;
begin
  if (EventName = 'OnTriChange') then
  begin
    ShowSortOrder := StrToBool(Params.Values['checked']);

    for I := 0 to IUMGrid1.Columns.Count - 1 do
      IUMGrid1.Columns.Items[I].Sortable := ShowSortOrder;

    IUMGrid1.Refresh;
  end;
end;

But the sort header column menu is always disabled even if the "Tri" checkbox is checked

image.png.9aa1ba32efac7da76ce902d6a7a4aaee.png

So what is wrong in my code ?

Link to comment
Share on other sites

i call 

currentHeaders.hide(true);

because if i don't do that the popup menu never disappears even if i click anywhere on the screen (with uniGUI 1.90.0 build 1568 Pro)

I'd like an checkbox in this popup menu for the user to enable or not sorting all columns (is disabled by default)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...