Results 1 to 6 of 6

Thread: jsonstore record is undefined

  1. #1

    Default jsonstore record is undefined

    Hello,
    I am having this problem while working in append mode with a jsonstore.
    Let's consider this store and associated grid:
    Code:
    var masterAssociationStore = new Ext.data.JsonStore({
        proxy: new Ext.data.HttpProxy({
            url: '....',
        }),
        baseParams: {
            start: 0,
            limit: thePageSize
        }
    });
    
    var sm = new Ext.grid.CheckboxSelectionModel({
        checkOnly: true
    });
    
    var masterGrid = new Ext.grid.GridPanel({
        store: masterAssociationStore,
        loadMask: true,
        title: "Currently Associated Invoices",
        frame: true,
        height: 200,
        defaults: {
            sortable: true,
            width: 150,
            resizable: true
        },
        selModel: sm,
        columns: [
        sm, {
            dataIndex: "masterInvoiceId",
            header: "masterInvoiceId"
        },
        {
            dataIndex: "masterInvoiceNumber",
            header: "masterInvoiceNumber"
        },
        {
            dataIndex: "mawbMbl",
            header: "mawbMbl"
        },
        {
            dataIndex: "hawbHbl",
            header: "hawbHbl"
        },
        {
            xtype: "datecolumn",
            format: "d/m/Y",
            dataIndex: "createdOn",
            header: "createdOn"
        }],
        tbar: [{
            text: 'Search',
            handler: function () {
                masterAssociationWin.show();
            },
            iconCls: 'icon-find'
        }]
    });
    where masterAssociationWin is a window in which I have a form used for searching items to add to the grid.
    This is the code I use to add records to the grid when I submit the form mentioned above:
    Code:
    invoiceAssociationSearchForm.getForm().submit({
        waitMsg: 'Submitting data...',
        success: function (form, action) {
            masterAssociationStore.loadData(action.result, true);
        },
        failure: function (form, action) {
            switch (action.failureType) {
            case Ext.form.Action.CONNECT_FAILURE:
                Ext.Msg.show({
                    title: 'Error',
                    msg: 'Server communication error',
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.ERROR
                });
                break;
            case Ext.form.Action.SERVER_INVALID:
                Ext.Msg.show({
                    title: 'Error',
                    msg: action.result.message,
                    buttons: Ext.MessageBox.OK,
                    icon: Ext.MessageBox.ERROR
                });
            }
        }
    });
    where invoiceAssociationSearchForm is the submitted form.
    Whenever the action returns records already existing in the store, I get an error:
    Code:
    record is undefined
    meta.value = column.re..., meta, record, rowIndex, i, store); ext-all-debug.js (row 68448)
    I am using Extjs ver. 3.2.0.
    I've already read about each record must having its own ID, so it could be the problem.
    But any workaround to work in append mode even if there are records with the same id already in the store?

    I thought the
    Code:
    loadData(action.result, true);
    would have avoided this kind of problems...

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    You need to configure "fields" or a "record". look at the examples

  3. #3

    Default

    Thanks a lot for your reply,
    I am trying to use an automatically configured jsonstore as masterAssociationStore, so I supposed the "fields" configuration would have been read from the server response in the "metadata" property.
    Does the jsonstore need to be configured initially with an empty array as "fields" property?
    Thanks again

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Yes, you should indeed initialize the reader with fields:[].

    ps. It's metaData and not metadata.

  5. #5

    Default

    Thanks, I'll try and post the results.

    ps. It's metaData and not metadata.
    Right, it's a typing error

  6. #6

    Default Solved

    Ok, it works, thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •