jQWidgets Forums

jQuery UI Widgets Forums Grid Foreign key ‘Cannot read property 'customer_id' of undefined’

Tagged: 

This topic contains 1 reply, has 1 voice, and was last updated by  JenkeNg 6 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • JenkeNg
    Participant

    This is a sudden error, and it has been no problem before, and now I can’t find the error.

    I intercepted some code snippets:

    var customerSource = {
    datatype: “json”,
    datafields: [
    { name: ‘customer_name’, type: ‘string’ },
    { name: ‘customer_id’, type: ‘string’ }
    ],
    url:’../../customer/getAllCustomer.do’,
    async:false,
    cache: false,
    id:’customer_id’
    };

    var customerAdapter = new $.jqx.dataAdapter(customerSource, { autoBind: true});
    console.log(customerAdapter);

    This is the customer resource obtained.

    var source = {
    filter: function() {
    $(“#baseDataGrid”).jqxGrid(‘updatebounddata’, ‘filter’); //过滤
    },
    sort: function() {
    $(“#baseDataGrid”).jqxGrid(‘updatebounddata’,’sort’);
    },
    sortcolumn: ‘statistics_id’,
    sortdirection: ‘desc’ ,
    dataType: “json”,
    dataFields:
    [
    { name: ‘customer_id’, type: ‘string’ },
    {
    name: ‘customer_name’, type: ‘string’,value: ‘customer_id’,
    values: { source: customerAdapter.records, value: ‘customer_id’, name: ‘customer_name’ }
    },
    { name: ‘order_amount’, type: ‘string’}
    ],
    cache: false,
    async:false,
    url: ‘../../contract/showContractStatisticsList.do’,
    data:{‘jsonParams’:JSON.stringify(jsonParams)},
    root: ‘rows’,
    id: ‘statistics_id’,
    beforeprocessing: function (data) {
    source.totalrecords = data.total;
    },
    updaterow: function (rowid, newdata, commit) {
    method.updateContractInfo(newdata);
    commit(true);
    }
    };

    This is the code that initializes the source


    JenkeNg
    Participant

    I think I probably found the cause of the problem, because the background database query data efficiency problem, recently I added a small SQL query, but did not notice the efficiency of the query. I optimized the speed of the query and the front end responded normally. At the beginning, the query speed is 0.021S, and after adding SQL, it is 0.45S. After optimization, it is about 0.021S. Can you explain the cause of this phenomenon? Because the amount of data is large, it is not always possible to guarantee fast query in the background.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.