1

can the feature of add/ remove columns given in the footer of this example of jqgrid (by clicking on choose columns)

http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithColumnChooser8.htm

can be applied on the datatables given in this link

http://datatables.net/examples/api/show_hide.html

what i am asking is can the same thing happen in datatable on a buttonclick event with almost same interface....

In datatable, there are toggle buttons outside the grid but in jqgrid, it opens a new window to add/ remove columns....

2 Answers 2

2

According to the forums, Allan has said it is not currently supported so a workaround is it has to be done via one of two methods: 1) Populate the data with the new/removed column and refresh/redraw the table (more overhead) 2) For adding a column if your case is simple you could prepopulate a few extra empty hidden columns in the initial data and simply show them as they are added. (less overhead)

See these threads for more insight:

http://datatables.net/forums/discussion/12270/dynamically-addremove-columns-datatables-warning.-requested-unknown-parameter.../p1

http://datatables.net/forums/discussion/8418/possible-to-dynamically-remove-or-add-a-column/p1

Sign up to request clarification or add additional context in comments.

Comments

1

jqGrid has hideCol and showCol methods which allows to hide or show column of the grid. The Column Chooser just provide more comfortable interface for the user to do the same. It allows additionally to change the order of the columns. If you want to have some other GUI for hiding (or showing) columns you can bind click event on any external links or buttons and to call hideCol and showCol inside of your implementation of the click event handler.

You can also consider to place additional buttons for hiding/showing directly in the column header like I described in the answer.

2 Comments

but this example is for the jqgrid... how can i do the same in datatables.... can u please provide me some working example...
@AryanVerma: I don't use datatables and don't know it. If you need a solution for datatable you should remove jqgrid tag from your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.