簡體   English   中英

Extjs中的行編輯插件問題

[英]Issue with Row Editing Plugin in Extjs

我在ExtJs中有一個完全可用的liveSearchGridPanel。 編輯任何行時發生錯誤。 發生的事情是,如果更新的行必須像我的情況一樣,當我改變用戶的年齡(我按年齡排序)時,行在網格中上升或下降,但之前的記錄仍然存在直到我手動刷新整個網頁。 屏幕截圖如下

編輯后我的網頁的屏幕截圖

我的代理模型是:

Ext.define('proxymodel', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'id',
        type: 'int',
        persist: false
    }, {
        name: 'gender',
        type: 'auto'
    }, {
        name: 'name',
        type: 'auto'
    }, {
        name: 'age',
        type: 'int'
    }],

    identifier: 'sequential', // to generate -1, -2 etc on the client
    proxy: {
        type: 'rest',
        //format: 'json',
        //appendId: false,
        idParam: "id",
        //limitParam:"",
        //filterParam: "",
        //startParam:'',
        //pageParam:'',
        url: 'http://localhost:3000/posts',
        api: {
            read: 'http://localhost:3000/db',
            create: 'http://localhost:3000/posts',
            update: 'http://localhost:3000/posts',
            destroy: 'http://localhost:3000/posts'

        },

        headers: {
            'Content-Type': "application/json"
        },

        reader: {
            type: 'json',
            rootProperty: 'posts',

            totalProperty: 'total'

        },
        writer: {
            type: 'json'
        }
    }
});

Application.js ,我將行編輯插件定義為:

var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
    listeners: {
        cancelEdit: function(rowEditing, context) {
            // Canceling editing of a locally added, unsaved record: remove it
            if (context.record.phantom) {
                store.remove(context.record);
            }
        },

        edit: function(editor, e) {
            // commit the changes right after editing finished
            e.record.commit();
        }
    }
});

我的商店看起來像:

Ext.define('Store', {
    extend: 'Ext.data.Store',
    storeId: 'peopleStore',
    pageSize: 500,

    //buffered: true,
    //leadingBufferZone: 300,

    pageSize: 5,

    autoLoad: {
        start: 0,
        limit: 5
    },
    autoSync: true,

    sorters: [{
        property: 'age',
        direction: 'ASC'
    }],

    groupField: 'gender'
});

誰能指出我的錯誤?

我在rowEditing 'edit'函數中編輯后嘗試重新加載我的商店,但它沒有用。

謝謝你的時間。

作為要求的完整答案:

你試過Ext.data.StoreManager.lookup('peopleStore').reload()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM