Results 1 to 5 of 5

Thread: Ext.data.store with json

  1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default Ext.data.store with json

    Hi
    I am trying to use grid with json. My json string looks something like

    { "name":"zys", model : { "address":"add", diskVolumeInfoList: {{"flags":13}} }
    }

    I created the store below to access flags attribute of diskVolumeInfoList

    Ext.define('User', { extend: 'Ext.data.Model', fields: [ {name: 'model.diskVolumeInfoList.flags', type: 'string'} ] });In the jsonReader , i don't want to set the root attribute because i want to use parent attributes like "name"

    The above code "model.diskVolumeInfoList.flags" do not work .
    Please suggest.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,381
    Answers
    3997
    Vote Rating
    1536
      0  

    Default

    Is that 100% what your JSON looks like?
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Answers
    3
    Vote Rating
    4
      0  

    Default

    Quote Originally Posted by praveen_pkc View Post
    Hi
    I am trying to use grid with json. My json string looks something like

    { "name":"zys", model : { "address":"add", diskVolumeInfoList: {{"flags":13}} }
    }

    I created the store below to access flags attribute of diskVolumeInfoList

    Ext.define('User', { extend: 'Ext.data.Model', fields: [ {name: 'model.diskVolumeInfoList.flags', type: 'string'} ] });In the jsonReader , i don't want to set the root attribute because i want to use parent attributes like "name"

    The above code "model.diskVolumeInfoList.flags" do not work .
    Please suggest.
    Use http://jsonlint.com/ to verify your json! It is not valid.

  4. #4
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default

    My point was , how do we access child attribute values with grid ? In the gridColumn can i use "model.diskVolumeInfoList.flags" ?

    The actuall json string is :

    {"diskPoolName":"dp_C_Drive","diskVolumnListByDiskPoolKey":"success","model":{"NBDGUp":true,"advancedDisk":true,"availableSpace":11433222144,"capacityManagedRetentionSupported":true,"comment":"This is on C:\\ Drive","diskVolumeInfoList":[{"flags":14,"id":"C:\\","independentMirror":false,"localCacheOn":0,"mediaServerName":null,"mirror":false,"name":"C:\\","networkOn":0,"operation":0,"otherProperties":null,"primary":false,"rawSize":42842714112,"replicationSource":false,"replicationTarget":false,"replicationTargetSTS":null,"snapShotEnabled":false,"state":0,"storageServerName":null,"storageServerType":null,"tdOn":0,"type":5,"usableSize":11433222144,"volumeDeleted":false}],"flags":515527,"highWaterMark":98,"inconsistentSnapshotMirror":false,"independentCopy":false,"key":{"diskPoolName":"dp_C_Drive","serverType":"AdvancedDisk"},"lifeCycleSupported":true,"lowWaterMark":80,"maxIOStreams":-1,"mediaServerList":["v-061604a.punin.sen.symantec.com"],"mirror":false,"name":"dp_C_Drive","openStorageType":true,"percentageFull":73.3135,"primary":false,"propertiesInconsistent":false,"propertyList":{"DSM::totalPhysicalCapacity":"42842714112","DSM::usedPhysicalSpace":"0","DSM::totalCapacity":"42842714112","DSM::flagsExt":"0","DSM::imported":"Yes","DSM::lowWaterMark":"80","DSM::createdTime":"1331178024","DSM:ystemTag":"Created by NetBackup","DG_TOTAL_SZ":"42842714112","DSM::usedSpace":"0","DG_FREE_SZ":"11433222144","DSM:tate":"2","DSM::userTag":"This is on C:\\ Drive","DG_USED_SZ":"31409491968","DSM::master":"v-061604a.punin.sen.symantec.com","DSM::majorEventSyncToken":"1331301581","DSM::highWaterMark":"98","DSM::flags":"515527","DSM::lastModifiedTime":"0","DSM::minorEventSyncToken":"771781","DSM:ervertype":"AdvancedDisk","DSM::maxIOStreams":"-1","DSM::fileSystemCardinal":"0"},"pureDisk":false,"rawSize":42842714112,"replicationPropertiesChanged":false,"replicationSource":false,"replicationTarget":false,"replicationTopologyChanged":false,"replicationVolumeDeleted":false,"serverType":"AdvancedDisk","sharedDiskType":false,"snapShotEnabled":false,"status":2,"statusString":"Up","storageServerList":[{"cloudEnabled":false,"cloudProviderName":"","cryptType":false,"key":{"stsName":"v-061604a.punin.sen.symantec.com","stsType":"AdvancedDisk"},"mediaServerList":[""],"snapshotEnabled":false,"storageServerId":"","storageServerName":"v-061604a.punin.sen.symantec.com","stsType":"AdvancedDisk","stuSubType":0}],"thirdPartyOSType":true,"usableSize":42842714112,"usedSpace":31409491968,"volumeList":["C:\\"]},"serverType":"AdvancedDisk","sessionId":3}

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    224
    Answers
    13
    Vote Rating
    10
      0  

    Default

    first check data / associations docs, maybe that can help you
    after you define your model with associations so there loading the json you can access the associated data (child data)

    theres some ways to access associated data in a grid.
    this actually depends on how you set the models
    like setting a renderer config (check docs for grid / column - renderer config )
    with a function similiar to
    Code:
      renderer : function(value,meta,record){
         associatedData =  record.getdiskVolumeInfoList()
         ... do something with associated data ...
         return ... something from associated data ... // this will be displayed in the grid respective column
    }

Posting Permissions

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