Results 1 to 4 of 4

Thread: About JsonStore, how it get data from JSon data, the data with Composite primary key

  1. #1

    Default About JsonStore, how it get data from JSon data, the data with Composite primary key

    Hi There,

    My code and sample data below:
    My JSonStore can't get data from Java.
    Composite primary key is PO and STYLE_NO
    -----------------------------------------
    var store = new Ext.data.JsonStore({

    var PaymentObj = [
    { name:'id', type:'string'},
    { name:'id.po', type:'string'},
    { name:'id.style_no', type:'string'},
    { name:'totalfee', type:'string'},
    { name:'paidfee', type:'string'},
    { name:'paydate', type:'string'}
    ];

    //Data
    var store = new Ext.data.JsonStore({
    url: 'payment_findPagePayment.do',
    root: 'root',
    totalProperty: 'total',
    autoLoad: {params:{start:0, limit:15}},
    fields: PaymentObj
    });

    //List
    var grid = new Ext.grid.GridPanel({
    store: store,
    cm: new Ext.grid.ColumnModel({
    defaults: { menuDisabled : true},
    columns:[new Ext.grid.RowNumberer(),
    {header: 'Client PO', width: 150,align:'center', dataIndex: 'id.po'},
    {header: 'Style No', width: 150,align:'center', dataIndex: 'id.style_no'},
    {header: 'Total', width: 150, align:'center',dataIndex: 'totalFee'},
    {header: 'Paid', width: 150, align:'center',dataIndex: 'paidFee'},
    {header: 'Date', align:'center',dataIndex: 'payDate'}]
    }),.......
    ----------------------------------------------
    //Sample JSon data from java action
    {total:2,
    root:[{"id":{"po":"56777","styleNo":"AAA1310"},
    "paidFee":500,
    "payDate":{"date":5,"day":1,"hours":0,"minutes":0,"month":0,"nanos":0,"seconds":0,"time":1420387200000,"timezoneOffset":-480,"year":115},
    "styleNo":"AAA1310","totalFee":1000},
    {"id":{"po":"56778","styleNo":"AAA0024"},"paidFee":600,
    "payDate":{"date":6,"day":2,"hours":0,"minutes":0,"month":0,"nanos":0,"seconds":0,"time":1420473600000,"timezoneOffset":-480,"year":115},
    "styleNo":"AAA0024","totalFee":2000}]}
    ------------------------------------------
    Thanks a lot

  2. #2
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781

    Default

    You'll need to use a convert function to concatenate two other mapped fields.

    Regards,
    Brian


  3. #3

    Default

    Thanks a lot,,

  4. #4

    Default

    my Extjs version is 3.3.0, there are no Ext.data.Model. So How can I handle Composite primary key? And could you give sample code that how load into the Ext.data.JsonStore? Thanks a lot

Posting Permissions

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