jqGrid Quick Tips
Get it!

Licensing and Flavours
jqGrid is an open-source control registed under the GPL and MIT lincenses. Basically this means that it's FREE! and you can do quite anything with it. Read more about this here. If you want to use the "side" versions of this control, specially wrapped and packaged for PHP, ASP.net Webforms and ASP.net MVC then you have to pay for them... but rust me when I say that all you need is on the Free package!! See the price list here You can also access the payed versions website here. The feature set is a huge list and has a awsome comunity on Stackoverflow that reply to your questions in no time.Columns
1. Hide a column
colModel: [{ name: 'colName', hidden: true }]
NavBar
1. Add custom buttons to the NavBar
/* Add this line to allow advanced search using the toolbar button */ $('#grid1').navGrid('#grid1pager', { search: true, edit: true, add: true, del: true }, {}, {}, {}, { closeOnEscape: true, multipleSearch: true, closeAfterSearch: true }); /* Add this line to include a separator between buttons */ $('#grid1').navSeparatorAdd("#grid1pager", { sepclass: 'ui-separator', sepcontent: '' }); /* Add this line to include custom buttons on the toolbar */ $('#grid1').jqGrid('navButtonAdd', "#grid1pager", { caption: "", buttonicon: "ui-icon-plusthick", onClickButton: function () { alert('Exporting!!!!!'); }, position: "last", title: "Export to Excel", cursor: "pointer" })
Search
1. Show the Advanced Search dialog from an external button
function OpenSearchDialog() { $("#grid1").jqGrid( 'searchGrid', { multipleSearch: true, overlay: false }); }
2. Show the filter toolbar
$('#grid1').jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false });
Selection
1. Get the ID of the selected row
$('#grid1').jqGrid('getGridParam', 'selrow')
2. Get the row data
var rowData = $("#grid1").jqGrid('getRowData', rowid);rowid: is the id value set on the data source, NOT the index of the row. This returns an object with the column names and value like:
{name="alex", address="here and there", age=34}so its easy then the get a value using:
var myName = rowData.name;Be aware that the object will only have the columns configured on the colModel.Everything that may come on the datasource won't appear here. If you want to have values here that you don't want to show on the grid you must add the column to the colModel collection and set it to hidden: true
发表评论
rCr6Am Utterly pent content material , regards for entropy.
6rAoMl Thanks for the article post.Really thank you! Awesome.
3KNgcj This web site truly has all of the info I wanted concerning this subject and didn at know who to ask.
x3IoP6 Your posts continually include many of really up to date info. Where do you come up with this? Just saying you are very creative. Thanks again
htljux Very good information. Lucky me I found your website by accident (stumbleupon). I have bookmarked it for later!
inemH3 Very good post.Really looking forward to read more. Keep writing.
I truly appreciate this blog.Really thank you! Cool.
Pklvro rs gold ??????30????????????????5??????????????? | ????????
OjbhTU Keep up the superb piece of work, I read few posts on this website and I conceive that your website is very interesting and holds lots of excellent information.
ZnV7BZ Very informative article post.Really looking forward to read more.
ZAhh3E A round of applause for your blog.Much thanks again. Cool.
NqRC7D I really enjoy the article.Really looking forward to read more. Will read on...