Results 1 to 2 of 2

Thread: Store And Json multidimensional

  1. #1
    Sencha User
    Join Date
    Oct 2016
    Posts
    52
    Answers
    1

    Default Store And Json multidimensional

    Hello everybody,
    I have a multidimensional json that I want to include in a store and after reading.
    JSON
    Code:
    {
      "Liste": 
        {
          "Number_Inventaire": "INV01",
          "Libelle_Inventaire": "Inventaire sur capsules K200",
          "Date_Inventaire": "02/11/2017 10:32:33",
          "Liste_Emplacement": [
            {
              "Number_emplacement": "EMP01",
              "Libelle_emplacement": "EMP1 2 Article",
              "Liste_Article":[
                {
                  "Number_article":"ART01EMP01",
                  "Libelle_article":"Charniere extra V001"
                },
                {
                  "Number_article":"ART02EMP01",
                  "Libelle_article":"Lisseuse inter vart 01235"    
                }
              ]
            },
            {
              "Number_emplacement": "EMP02",
              "Libelle_emplacement": "EMP2 3 Article",
              "Liste_Article":[
                {
                  "Number_article":"ART01EMP02",
                  "Libelle_article":"Charniere extra V001"
                },
                {
                  "Number_article":"ART02EMP02",
                  "Libelle_article":"Bricole"
                },
                {
                  "Number_article":"ART03EMP02",
                  "Libelle_article":"just one"
                }
              ]
            },
            {
              "Number_emplacement": "EMP03",
              "Libelle_emplacement": "EMP3 Aucun Article",
              "Liste_Article":[]
            }
          ]
        }
    }
    STORE
    Code:
    ListeArticleStoreS = Ext.create('Ext.data.Store', {
                autoLoad: true,
                //model: 'ListeArticleJsonModel',
                fields: ['Number_emplacement', {
                    name: 'oq1',
                    mapping: 'Liste_Article.Number_article'
                }, {
                    name: 'oq2',
                    mapping: 'Liste_Article.Libelle_articleS'
                }],
                autoSync: true,
                pageSize : 6,
                //remoteSort: true,
                proxy: {
                    type: 'ajax',
                    //type:'jsonp',
                    url:'resources/data_Globale.json',
                    //url:serveur+'Monitoring_Get_Production_Headset_Data_By_Line_Previous_Day_For_Chart?callback=Ext.data.JsonP.callback1',
                    reader: {
                        type: 'json',
                        rootProperty: 'Liste.Liste_Emplacement'
                    }},
                }
            });
    AND CONSOLE
    Code:
    ListeArticleStoreS.on('load', function () {    
                ListeArticleStoreS.each(function(rec) {
    
                        console.log('Emplacement:', rec.get('Number_emplacement'));
                        console.log(' Article(s):', rec.get('oq1'));
                        console.log('---------------------------------------');
    
                });
            });
    Thank you for your help

  2. #2
    Sencha User
    Join Date
    Oct 2016
    Posts
    52
    Answers
    1

    Default

    Hello
    I am in a difficulty with this project, do you have an idea to build the models.
    Thanks for your feedback

Similar Threads

  1. Getting data from a multidimensional JSON
    By ev3rsor in forum Sencha Touch 2.x: Q&A
    Replies: 5
    Last Post: 15 Jul 2012, 7:06 AM
  2. [SOLVED]Multidimensional JSON object in JS
    By PranKe01 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 17 Nov 2009, 1:40 AM
  3. Multidimensional JSON from PHP
    By alessandro in forum Ext 3.x: Help & Discussion
    Replies: 7
    Last Post: 18 Aug 2009, 7:54 AM
  4. multidimensional array from json php
    By paweln in forum Ext 2.x: Help & Discussion
    Replies: 9
    Last Post: 30 Jun 2009, 12:53 PM

Posting Permissions

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