When I see the jqgrid demo, the columnname开发者_如何转开发s often on the top of the jqgrid.behind it is the searchtoolbar.Now ,I want to change the position of the cloumnnames and the searchtoolbar.I want to put the searchtoolbar on the top of the jqgrid. I look at the source code of jqgrid in C#, and I see the JQgridRenderer.cs, but fail to find the code about it.Can anyone help me ?thanks!
You question in not so easy in the implementation.
You can try the following code
var grid = $("#list"), i,
$htableTHead = grid.closest('div.ui-jqgrid-view')
.find('table.ui-jqgrid-htable>thead'),
$lables = $htableTHead.children('tr.ui-jqgrid-labels'),
$thColumn = $lables.children('th'),
$searchToolbar = $htableTHead.children('tr.ui-search-toolbar'),
$thToolbar = $searchToolbar.children('th'),
l = Math.min($thToolbar.length, $thColumn.length),
h = grid[0].grid.headers;
for (i = 0; i < l; i += 1) {
$thToolbar[i].style.cssText = $thColumn[i].style.cssText;
$thColumn[i].style.cssText = "";
h[i].el = $thToolbar[i];
}
$htableTHead.children('tr.ui-search-toolbar').prependTo($htableTHead);
As the result you will have
see the demo here.
It's close to what you want, but if you will try to use sortable: true
for example you will receive problems which can't be fixed without changing of some jqGrid code. So I can't grantee that the code above will work in all another situations.
精彩评论