这可能更清楚: 我有几十亿个treegrid的记录数据,我使用插件jqwidget treegrid使用"虚拟模式"但是更新数据的编辑过程不起作用,它不会向服务器发送数据。 我该如何解决这个问题。
或者我必须更改插件,你能不能给我一些建议来找到最好的treegrid插件。
这是我的代码
$("#jqxTreeGrid&#34)。jqxTreeGrid({
宽度:' 100%',
图标:是的,
autoRowHeight:是的,
showHeader:是的,
columnsHeight:30,
columnsResize:true,
columnsReorder:true,
可过滤的:是的,
filterMode:' advanced',
sortable:是的,
pageable:false,
pagerMode:' advanced',
altRows:是的,
showToolbar:true,
showStatusbar:true,
toolbarHeight:35,
editable:true,
editSettings:{saveOnPageChange:true,saveOnBlur:true,saveOnSelectionChange:true,cancelOnEsc:true,saveOnEnter:true,editSingleCell:false,editOnDoubleClick:true,editOnF2:true},
pageSizeOptions:[' 5',' 10',' 25',' 50',' 100',&# 39; 200',' 500',' 1000'],
virtualModeRecordCreating:function(record){
if(record.is_leaf)
{
record.leaf = true;
}
},
virtualModeCreateRecords:function(expandedRecord,done){
var source =
{
dataType:" json",
dataFields:[
{name:' group_pin',输入:' string'},
{name:' root_of',输入:' string'},
{name:' user_pin_owner',输入:' string'},
{name:' name',type:' string'},
{name:' name_alias',输入:' string'},
{name:' url',输入:' string'},
{name:' avatar',type:' string'},
{name:' type',type:' string'},
{name:'地址',输入:' string'},
{name:' icon',输入:' string'},
{name:' is_leaf',输入:' bool'},
{name:' description',输入:' string'}
]
键入:' GET',
cache:false,
id:' group_pin',
层次结构:
{
keyDataField:{name:' group_pin' },
parentDataField:{name:' root_of' }
},
网址:' http://localhost/app/listdata',
root:" listData",
addRow:function(rowID,rowData,position,parentID,commit){
提交(真);
newRowID = rowID;
},
updateRow:function(rowid,rowdata,commit){
$就({
键入:" POST",
网址:' http://localhost/app/save',
dataType:' json',
数据:$ .param(rowdata),
错误:function(xhr,textStatus,errorThrown){
提交(假);
},
success:function(data,textStatus){
if(data [' response'] == true)
{
提交(真);
}
else
{
commit(false);
}
}
});
}
};
var dataAdapter = new $.jqx.dataAdapter(source,{
beforeSend: function (xhr) { },
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) {
done(dataAdapter.records);
$("#clearParentGroupbuttom").addClass("disabled");
if(data.listData.length > 0)
{
for(var i=0; i<data.listData.length; i++ )
{
if(data.listData[i].root_of != '')
{
$("#jqxTreeGrid").jqxTreeGrid('expandRow', data.listData[i].root_of);
}
}
}
},
beforeLoadComplete: function (records) { },
loadError: function (xhr, textStatus, errorThrown) {
done(false);
},
formatData: function (data) {
if (expandedRecord == null)
{
data.parent_code = ""
}
else
{
data.parent_code = expandedRecord.group_pin;
}
var pageSize = $('#jqxTreeGrid').jqxTreeGrid('pageSize');
return data;
}
});
dataAdapter.dataBind();
},
columns: [
{
text: 'Name',
pinned: true,
dataField: 'group_pin',
editable: false,
align: 'center',
hidden: true,
sortable: true,
filterable: true,
width: 150
},{
text: 'Name',
pinned: true,
dataField: 'name',
align: 'center',
minWidth: 200,
width: 350,
cellsRenderer: function (rowKey, column, cellValue, rowData, cellText) {
return cellValue + " (<b style='font-size:10px;'>Pin: " + rowData["group_pin"] + "</b>)";
},
validation: function (cell, value) {
if (value == "")
{
return { result: false, message: "<?php echo trans('garputala.required_textbox'); ?>" };
}
return true;
}
},{
text: 'Owner',
pinned: true,
dataField: 'user_pin_owner',
editable: false,
hidden: true,
align: 'center',
cellsAlign: 'center',
width: 100
}
]
});
由于 丽都
答案 0 :(得分:1)
你应该实现&#34; updateRow&#34; TreeGrid's源对象中的函数。在那里你应该进行AJAX调用,将更新的数据发送到你的服务器。以下是&#34; updateRow&#34;。
的示例定义 updateRow: function (rowID, rowData, commit) {
// synchronize with the server - send update command
// call commit with parameter true if the synchronization with the server is successful
// and with parameter false if the synchronization failed.
commit(true);
}