dynamic colmodel in jqgrid - jqgrid

I want to change the colmodel of jqgrid dynamically on the basis of dropdown I am able to do it using gridunload function but by using this function it seems that the whole page is loaded once again.
so is there any other way to dynamically load colmodel of grid

Related

How to Update Jquery Data Table

I am using Jquery data table plugin. I was able to display it properly with filtering, sorting and Paging.
But, now the problem is i need to filter the data table rows based on dropdown selection made.
but, i do not have any idea how to do this..I am very new to MVC. So, here i need to send that dropdown selected item as parameter to a server side method and call a method and rebind data to the data table.
I am initially binding data to the data table using for loop and iterating over a datatable
Do i need to use Ajax here..if so how to get the new datatable/data to this view and bind to data table?
Please suggest the way to do..
you use the jquery datatable for this
create function and paste jquery datatable code in there
then call this function on dropdown selection change using jquery.
Tips :jquery datatable code available on net find and use it

jqGrid How to remove all rows without calling loadComplete

Is there a way to remove all the rows in the jqGrid, without calling jqgrid's loadComplete method.
You can use clearGridData. From the jqGrid documentation:
Clears the currently loaded data from grid. If the clearfooter parameter is set to true, the method clears the data placed on the footer row.
A quick inspection of the code seems to confirm that this method does not call loadComplete, although it will call gridComplete.

Client side paging on Jqgrid?

could anyone tell me how to implement client side paging on jqgrid?
Currently, my pager just shows one page which is an error. However, if I change the number of records per page using the drop down, the grid is updated accordingly. But I am unable to navigate thru the pages.
Thanks in advance
I suppose that you fill the grid in the wrong way. You don't included any code in your question, so I can only guess that you use addRowData method to fill the grid. If it's so, then you should know that the usage of addRowData method it the worst and the slowest way to fill the grid which I know.
The best way in case of datatype: 'local' is to use data option of jqGrid in combination with gridview: true. It sorts the data from the data parameter corresponds with sortname and sortorder options, create jqGrid and display the first page of the grid (the size of the page defines rowNum option). The value of data parameter should be array of items which represent the grid rows. Every item should contains properties with the names like the name property of colModel. Additionally every item of data should contains id property which unique value will be used as id attribute of rows (id of <tr> elements).

Adding a jqGrid pager after Grid creation

Does anybody know how adding a jqGrid pager after grid creation using 'tableToGrid' function?
jqGrid uses internally the setPager function to make the most work for creating of the pager. The function setPager is local and can't be called from the outside.
If you need have in some situation the pager I would recommend you to create it always, but hide with respect of $('#pager').hide() till the pager will be needed. The grid with hidden pager looks exactly like the grid without pager.

jqGrid onselectrow

I'm using a jqGrid, and it gets populated fine. From the UI perspective, one of the columns in the jqGrid is editable. How can I make one of the columns as editable (say like a text box)?
The reason is, in my case when the grid successfully loads, the UI is going to show one of the column's values as editable.
If you're looking to edit the column values directly in the grid, similarly to how you might in Excel, look into the inline editing API:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:inline_editing&s[]=inline
In colmodel, you have to specify editable: true.Provide edit action link in editURL:... option of jqgrid.
you have to get the "id" of that column and then remove 'disabled' attribute on that.
for example -
$('#idofthatcolumn').removeAttr('disabled');
OR
$('#idofthatcolumn').removeAttr('readonly');
In your colmodel you should specify editable as true i.e, editable:true and specify the editUrl:'localhost:8080/yourApp'
Also if you want to store it in the client side, then specify it as editUrl:'clientArray'

Resources