gpt4 book ai didi

extjs - 从存储分页内存中删除记录后刷新 Extjs 网格

转载 作者:行者123 更新时间:2023-12-04 21:38:14 26 4
gpt4 key购买 nike

我有 EXT JS 网格。当我从网格中删除记录时,它会从页面中删除。但是,当我执行 next/prev 时,数据会再次显示。
删除记录后,工具栏也不会显示正确的统计信息。

你能帮忙吗?

<script type="text/javascript" src="/extjs-4.0.7/ext-all.js"></script>
<script type="text/javascript" src="/extjs-4.0.7/examples/ux/data/PagingMemoryProxy.js"></script>

<link rel="stylesh`enter code here`eet" type="text/css" href="/extjs-4.0.7/resources/css/ext-all.css" />

<script>
var selectedRecord = null;

function getRecord() {
return selectedRecord;
}

var data = '{"user":[sample date for the grid]}';
var workitemList = "";
var selectedItems = new Array();

Ext.onReady(function() {
Ext.QuickTips.init();
Ext.tip.QuickTipManager.init();

Ext.define('Model', {
extend: 'Ext.data.Model',
fields: [{
name: 'WORKITEMID',
mapping: 'WORKITEMID'
},
{
name: 'ALERTID',
mapping: 'ALERTID'
},
]
});

var storeMain = Ext.create('Ext.data.Store', {
model: 'Model',
autoLoad: false,
buffered: false,
pageSize: 5,
data: [],
proxy: {
type: 'pagingmemory',
reader: {
type: 'json',
root: 'user'
}
},
remoteSort: true,
remoteFilter: true,
remoteGroup: true
});

var sm = Ext.create('Ext.selection.CheckboxModel', {
listeners: {
selectionchange: function(sm, selections) {
selectedItems = selections;
}
}
});

var myGrid = new Ext.grid.Panel({
title: 'Unassign Alerts',
collapsible: false,
border: true,
loadMask: true,
frame: false,
id: 'myGridId',
columnLines: true,
animCollapse: false,
loadMask: true,
stripeRows: true,
renderTo: Ext.getBody(),
store: storeMain,
selModel: sm,
columns: [
{
text: 'Alert ID',
dataIndex: 'WORKITEMID',
flex: 8 / 100
}
],

listeners: {
'afterrender': function(e) {
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
},
'columnresize': function(e) {
var gridthWidth = this.getWidth();
this.setWidth(gridthWidth);
this.setAutoScroll(true);
},
cellclick: function(iView, iCellEl, iColIdx, iRecord, iRowEl, iRowIdx, iEvent) {
if (iColIdx == 1) {
selectedRecord = iRecord;
}
},
render: function(e) {
this.store.getProxy().data = Ext.decode(data);

//this.store.pageSize =25;
this.store.load();

this.store.on('load', function() {
//myMask.hide();
});
e.style = " background-color: #003464;";
}
},
bbar: new Ext.PagingToolbar({
store: storeMain,
id: 'Ptoolbar',
pageSize: 5,
displayInfo: true,
height: 25,
//plugins: Ext.create('Ext.ux.ProgressBarPager', {}),
displayMsg: 'Displaying Records {0} - {1} of {2}',
emptyMsg: "No records to display",
listeners: {
afterrender: function() {
this.child('#refresh').hide();
}
},
buttons: [{
id: 'btnID',
itemId: 'saveBtn',
pressed: true,
frame: true,
text: 'Remove',
handler: function(store) {
if (selectedItems.length > 0) {
store.remove(selectedItems);
Ext.getCmp('clientSummaryGridId').getView().refresh();
} else {
Ext.Msg.alert("Result", "No selection");
}
}
}]
})
});
});
</script>

最佳答案

如果

Ext.getCmp('myGrid').getView().Refresh();

不工作你也可以试试
Ext.getCmp('myGrid').reconfigure(gridstore);

因此,无论何时从网格中删除记录,您都可以使用此语句。

关于extjs - 从存储分页内存中删除记录后刷新 Extjs 网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33095081/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com