我开始玩jqgrid Treegrid,但我还是没有看到设置备用行背颜色.这可能吗?
解决方法
如果你的意思是altRows和altclass参数,那么就没有用.要准确地在树网格初始化时间(在setTreeGrid内部),将重置一些jqgrid参数.如何查看
here,altRows参数的值将设置为false.如果你想象树节点的扩展/折叠可以改变树项的顺序,那么改变的原因就很明显了所以你会有
从原始的树
更新:解决方法始终存在.请参阅the demo,其中包含以下代码:
var resetAltRows = function () { // I think one can improve performance the function a little if needed,// but it should be done the same $(this).children("tbody:first").children('tr.jqgrow').removeClass('myAltRowClass'); $(this).children("tbody:first").children('tr.jqgrow:visible:odd').addClass('myAltRowClass'); }; $("#tree").jqgrid({ url: 'AdjacencyTreeAltRows.json',datatype:'json',mtype:'GET',colNames: ["ID",'Description',"Total"],colModel: [ {name:'id',index:'id',width: 1,hidden: true,key: true},{name:'desc',width:180,sortable:false},{name:'num',width:80,sortable:false,align:'center'} ],treeGridModel:'adjacency',height:'auto',//altRows: true,//altclass: 'myAltRowClass',rowNum: 10000,treeGrid: true,ExpandColumn:'desc',loadComplete: function() { var grid = this; resetAltRows.call(this); $(this).find('tr.jqgrow td div.treeclick').click(function(){ resetAltRows.call(grid); }); $(this).find('tr.jqgrow td span.cell-wrapper').click(function(){ resetAltRows.call(grid); }); },ExpandColClick: true,caption:"TreeGrid Test" });
原文地址:https://www.jb51.cc/jquery/181221.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。