I would like to show the empty grid with column name on page load and when user click on the search button, it will take the data from the database table in the form of data table and need to bind into the jqGrid.
I was looking into this and this solution, but they have 2 call at the same time one is calling the column with data other is calling only data.
I would like the solution which bind the column on page load and data on button click.
$(document).ready(function () {
//Load Empty jqgrid dynamically using datatable row column...
$(gridData).jqGrid({
url: "../Generic/GetRowColumns",
colNames: colNames, // this would bind dynamically
colModel: colModel // this would bind dynamically
});
$("#btnSubmit").click(function () {
var data = $("#dataForm").serialize();
//Bind jqGrid by datatable on ajax call
$(gridData).jqGrid({
url: "../Generic/GetRowColumns",
data: data,
colNames: colNames, // this would bind dynamically
colModel: colModel // this would bind dynamically
});
});
});
So on the first call it should bind empty grid with columns returns from the datatable and the other call (button click) in the same grid, grid will bind with data.
Need some help. Thanks in Advance.