jqGrid - how to change title based on colModel sortable property -
when mouse hovers on each column i'd tooltip indicate whether column sortable.
able change title attribute this:
$("#list .ui-th-column").each(function(i) { var issortable = % 2; $(this).attr('title', issortable ? "not sortable" : "click header sort."); });
i'd replace demo expression 'i % 2' check of colmode's sortable property, can't figure out how value of colmodel's sortable property.
colmodel: [ { name: 'name', index: 'name', width: 100, sortable: true }, { name: 'note', index: 'note', width: 200, sortable: false } ]
i've tried .getgridparam , .getcolprop don't think syntax i'm using correct.
to value of sortable
property other property column definition can following:
var grid=$("#list"); var propsname = grid.jqgrid('getcolprop','name'); var propsnote = grid.jqgrid('getcolprop','note'); alert("'name' has sortable="+propsname.sortable+ "\n'note' has sortable="+propsnote.sortable);
to set tooltip on column header can following
var settooltipsoncolumnheader = function (grid, icolumn, text) { var thd = $("thead:first", grid.hdiv)[0]; $("tr th:eq(" + icolumn + ")", thd).attr("title", text); }; var grid=$("#list"); settooltipsoncolumnheader(grid,2,"bla bla!");
here identify column index of visible columns.
you can easy rewrite code examples purpose.
Comments
Post a Comment