Page 1 of 1

JQGrid Columns selection (show / hide)

PostPosted: 04 Apr 2017 00:43
by fateh78
Dear CGDevToolers
is there any property in JQGrid to choose visible columns (someting like devexpress grid)

DevExpress Grid Column Selector.png

Re: JQGrid Columns selection (show / hide)

PostPosted: 04 Apr 2017 09:59
by Alexander Bulei
Hi fateh78,

s there any property in JQGrid to choose visible columns (someting like devexpress grid)


Yes, please check the JQGridColumnChooser.

Best Regards.

Re: JQGrid Columns selection (show / hide)

PostPosted: 07 Apr 2017 10:29
by fateh78
thanks Alexander

i tried to implement my own chooser by using ContextMenu with checkboxes to select visible columns as shown in attached pic.
then used the onhide event of the ContextMenu :
Code: Select all
procedure TMastersBaseForm.cmColumnChooserJQContextMenuOptionsEventsHide(Sender: TObject; AParams: TStringList);
var       i : integer;
begin
  inherited;
  for i := 0 to cmColumnChooser.JQContextMenuOptions.Items.Count-1 do begin
      grdDetailItems.JQGridColumns[i].Hidden := not cmColumnChooser.JQContextMenuOptions.Items[i].TypeCheckboxOptions.Selected;
      HeaderDataSet.Fields[i].Visible := cmColumnChooser.JQContextMenuOptions.Items[i].TypeCheckboxOptions.Selected;
  end;
  //grdDetailItems.AjaxReRender();
  grdDetailItems.JQGridOptions.RemapColumns([0,1,2,3,4,5,6,7,8,9,10], True, False);
end;


but the problem is : "cmColumnChooser.JQContextMenuOptions.Items[i].TypeCheckboxOptions.Selected" does not reflect the selected checkboxes by user.

is this a bug or i missed something ??

best regards

Re: JQGrid Columns selection (show / hide)

PostPosted: 07 Apr 2017 10:30
by fateh78
i missed the pic
ContextMenu.png

Re: JQGrid Columns selection (show / hide)

PostPosted: 10 Apr 2017 11:24
by Alexander Bulei
Hi fateh78,

In this case, you need re-render the contextmenu, because this property doesn't support ajax change.

Best Regards