Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何删除网格存储extjs中的空值_Extjs_Grid - Fatal编程技术网

如何删除网格存储extjs中的空值

如何删除网格存储extjs中的空值,extjs,grid,Extjs,Grid,当存储Grid.json格式时,该值变为null {“结构网格”:[{“id”:null,“结构网格”:null}]} 网格是 var grid1=Ext.extend(Ext.grid.GridPanel{ border: false, width: 'auto', height: 300, hideHeaders: true, initComponent: function () { var config = { // store store: s

当存储Grid.json格式时,该值变为null {“结构网格”:[{“id”:null,“结构网格”:null}]}

网格是

var grid1=Ext.extend(Ext.grid.GridPanel{

border: false,
width: 'auto',
height: 300,
hideHeaders: true,
initComponent: function () {


    var config = {
        // store
        store: struct_grid_Store

        // column model
        , columns: [
              { text: "struct_grid", dataIndex: 'struct_grid' }
        ]

        // force fit
        , viewConfig: { forceFit: true, scrollOffset: 0 }


    }; // eo config object

    // apply config
    Ext.apply(this, Ext.apply(this.initialConfig, config));
商店是

var struct_grid_Store = new Ext.data.Store({
 reader: new Ext.data.JsonReader({
     fields: ['id', 'struct_grid'],
     root: 'struct_grid'
 }),
 proxy: new Ext.data.HttpProxy({
    url: '../../EicePackege/phpframework/DefStruct.php?mode=struct_grid',
 }),

 autoLoad: true,
 remoteSort: true
 });

当记录根本不是记录时,您不应该从服务器发回它

{"id":null,"struct_grid":null}
是一个有效的JSON字符串,因此它是一个有效的JavaScript对象,默认情况下它将是一个有效的模型实例。因此记录将存在于存储中,因此它将被显示。ExtJS做得很好。是的,您可以通过调整读卡器来处理此问题,但这是错误的方法


如果您不想要任何记录,您应该不发送任何记录。

您的图像太小,看不到任何内容。而且,您的问题也不清楚。您将null作为一个值传回,您希望发生什么?如果所有字段都为null,包括
id
,那么您为什么要传递这些数据?我总是在数据服务器端筛选null值和其他内容以供参考减少客户端的代码量实际上,当从php脚本中传回null作为值时,它会在网格中显示空白行。如何在extjs的客户端处理不应在网格中显示的null值。!@TheRaaaZ需要在服务器端处理所有这些吗…?不需要,但需要实现一个自定义的reader子类来处理这个。谢谢你的回答,我已经应用了它,但我想从客户端而不是服务器端处理它。请注意这一点。@ankitverma,正如我提到的,你需要为这个创建自己的阅读器。但是让我告诉你,这是一种肮脏的编程风格。你不应该做这样的事情!