Reputation: 3803
I have the added the following code after setting the column and other required things in jqGrid
.navGrid('#pager', { search: false, view: false, del: false, add: false, edit: false },
{}, // default settings for edit
{}, // default settings for add
{}, // delete instead that del:false we need this
{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }, // search options
{} /* view parameters*/
).jqGrid ('navButtonAdd', '#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns",
onClickButton: function() {
grid.jqGrid('columnChooser');
}}).trigger("reloadGrid");
Grid is loading fine. Am trying to implement Column chooser. When i click the button am getting "Grid is undefined"
. Am i missing any files or is the way that i coded wrong ?
Am stuck here. Correct me if am doing wrong.
Upvotes: 0
Views: 2382
Reputation: 3803
Basic mistake.
i was using below code
jQuery('#list1').jqGrid
but if we want to use grid in other places we need to use
add at the top
var grid = jQuery('#list1');
Upvotes: 0
Reputation: 1225
Just add the gridId before the declaration of your statement so that it can be identified with respect to the grid as given below :
$("#grid_name").navGrid('#pager', { search: false, view: false, del: false, add: false, edit: false },
{}, // default settings for edit
{}, // default settings for add
{}, // delete instead that del:false we need this
{closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }, // search options
{} /* view parameters*/
).jqGrid ('navButtonAdd', '#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns",
onClickButton: function() {
grid.jqGrid('columnChooser');
}}).trigger("reloadGrid");
Upvotes: 1