gpt4 book ai didi

extjs4 - 如何在Extjs中清除网格

转载 作者:行者123 更新时间:2023-12-04 13:32:48 25 4
gpt4 key购买 nike

我在Extjs中有一个GridStore,可以存储带有两个网格列的记录。我在网格中存在一条记录时遇到问题,如果我删除网格,它已在服务器端成功删除,但是在网格中仍然存在。

样例代码:

    xtype: 'grid',
store: 'SampleStore',
border: false,
width : 542,
ref: '../sampleGrid',
id: 'sampleGrid',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'name',
header: 'Name',
sortable: true,
.............
view: new Ext.grid.GridView({
forceFit: true
})

预先感谢您的帮助。

最佳答案

确保您正在使用:

grid.getStore().remove(record); //remove record from grid
grid.getStore().sync(); //sync with server

如果要删除所有项目,请执行以下操作:
grid.getStore().removeAll();
grid.getStore().sync();

但小心点!那将删除所有内容!

关于extjs4 - 如何在Extjs中清除网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17832428/

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