|
楼主 |
发表于 2016-11-23 15:48:40
|
显示全部楼层
我暂时解决了,代码不好跟踪。
修改 /UI2/system/components/justep/grid/grid.js
改完后在\tools\dist目录下执行 dist.bat
--------------------修改第一段------------------------------
//增加更多行
if(!offset && dataTreeOps.isDelayLoad){
var parentRow = p.row.parent();
var pRows = parentRow?parentRow.rows.get():data.datas.get();
if(data.hasMore(parentRow) && p.index + 1 === pRows.length){
var moreR = new TreeGridRow(p.row, _treeExpColArray.concat([data.idColumn,expandColumn]));
$.each(_treeExpColArray,function(i){
moreR.val(_treeExpColArray[i], r.val(_treeExpColArray[i]));
moreR.val(treeOps['leaf_field'],true);
moreR.val(treeOps['virtual_field'],true);
moreR.val(data.idColumn, Data.UUID());
if(parentRow){ //不知道用什么字段来存储是否有ParentRow,先用显示名称来判断,少三个点
moreR.val(expandColumn, '更多......');
}else{
moreR.val(expandColumn, '更多...');
}
});
datas.push(moreR);
}
}
}, data, parent);
--------------------修改第二段------------------------------
on('jqGridRenderTreeVirtualRow',function(evt,evtData){
var expandColumn = self.getGridParam('expandColumn');
var curDisplayName = evtData.row[expandColumn];
var row = data.getRowByID(evtData.row[treeOps['parent_id_field']]);
$(evtData.tr.cells[evtData.expCol])
.attr("colspan",colModel.length)
.addClass("x-grid-tree-more");
$(evtData.tr)
.on('click',function(evt){
if(curDisplayName === "更多..."){ //用显示名称来判断是否存在parent,没有parent就直接翻页
data.loadNextPageData();
}else{
var offset = data.getOffset(row);
self._appendData = true;
try{
data.loadNextPageData({
append : true,
parent : row
});
}finally{
self._appendData = false;
}
self.domNode.p._appendData = self._getDatas(row,offset);
self.domNode.p.treeANode = evtData.tr.rowIndex;
self.domNode.p.insertBefore = true;
self.reload();
if(!data.hasMore(row)){
$(evtData.tr).remove();
}
}
return false;
}).children("td:lt("+evtData.expCol+"),td:gt("+evtData.expCol+")").remove();
}); |
|