1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    kirubasankars is on a distinguished road

      0  

    Default Unanswered: JSON Nested : Current ExtJS data modeling not scalable?

    Unanswered: JSON Nested : Current ExtJS data modeling not scalable?


    Json nested data is a basic future of json and it is mutlti-dimension data modeling. Current ExtJS data modeling is not scalable.

    Current ExtJS Model is try to simulate two dimension data modeling (Rows and Columns). which is not possible use with document based databases and etc.  Reason is model association work with 1st-level attributes only.

    Solution could be, New attribute can be introduced with association called "path" (where framework can go and find a model if nested) instead of getProducts() or getCustomer()

    Example :

    {
    type : 'order',
    orderItem : [
    {
    qty: 4,
    productid : 'PU001'
    },
    {
    qty: 5,
    productid : 'PU002'
    }
    ],
    customerid : 'CU001'
    }

    orderItem can be validated if array then child element.


    Ext.define('Order',{ extend:'Ext.data.Model', fields:['id','name','email'], hasMany:{model:'Order', name:'orders', path : 'orderItem.productid'} hasOne: {model: 'Customer', name: 'customer', path : 'customerid' }
    });

    Is it make scene,? Anybody has better approach?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,645
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    associationKey is the config that is suppose to be able to tell the association where the data is. Currently it does only go to the first level but I have a merge request where associationKey can accept a string that will allow it to traverse objects/arrays to deeply nested data. This will likely not make it in till 4.2
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1