1. #11
    Ext JS Premium Member
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    elemeNt_Mike is on a distinguished road

      0  

    Default


    <?xml version="1.0" encoding="utf-8"?>
    <Tread ID="132">
    <Post
    PostID="100871"
    Subject="Sample title1"
    Content="Sample content0"
    PostedBy="User0"
    />
    <Post
    PostID="100872"
    Subject="Sample title2"
    Content="Sample content1"
    PostedBy="User1"
    />
    <Post
    PostID="100873"
    Subject="Sample title3"
    Content="Sample content2"
    PostedBy="User2"
    />
    <Post
    PostID="100874"
    Subject="Sample title4"
    Content="Sample content3"
    PostedBy="User3"
    />
    <Post
    PostID="100875"
    Subject="Sample title5"
    Content="Sample content4"
    PostedBy="User4"
    />
    </Tread>

    First, i am sorry for my english!
    i try to get the attributes of record:'Post'.
    Can somebody help me! Thanks!

  2. #12
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Use '@', e.g.
    Code:
    reader: new Ext.data.XmlReader({
      record: 'Post',
      fields: [
        {name: 'PostID', mapping: '@PostID'},
        {name: 'Subject', mapping: '@Subject'},
        {name: 'Content', mapping: '@Content'},
        {name: 'PostedBy', mapping: '@PostedBy'},
      ]
    })

  3. #13
    Ext JS Premium Member
    Join Date
    Jan 2010
    Posts
    2
    Vote Rating
    0
    elemeNt_Mike is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Use '@', e.g.
    Code:
    reader: new Ext.data.XmlReader({
      record: 'Post',
      fields: [
        {name: 'PostID', mapping: '@PostID'},
        {name: 'Subject', mapping: '@Subject'},
        {name: 'Content', mapping: '@Content'},
        {name: 'PostedBy', mapping: '@PostedBy'},
      ]
    })
    Thanks, it work.

  4. #14
    Sencha User ronivcp's Avatar
    Join Date
    Jan 2010
    Location
    Argentina
    Posts
    29
    Vote Rating
    0
    ronivcp is on a distinguished road

      0  

    Default


    I'm trying to parse this XML and I'm having some problems:


    ...
    <info>
    <Case id='1' color='blue'/>
    <Case id='2' color='green'/>
    <Case id='3' color='purple'/>
    <Case id='4' color='red'/>
    </info>
    <data>
    <item value_x='Dec 25, 2008'>
    <value Case_id='1'>17</value>
    <value Case_id='2'>0</value>
    <value Case_id='3'>1</value>
    <value Case_id='4'>2</value>
    </item>
    <item value_x='Jan 29, 2009'>
    <value Case_id='1'>873</value>
    <value Case_id='2'>5</value>
    <value Case_id='3'>0</value>
    <value Case_id='4'>0</value>
    </item>
    <item value_x='Feb 16, 2009'>
    <value Case_id='1'>54</value>
    <value Case_id='2'>4</value>
    <value Case_id='3'>0</value>
    <value Case_id='4'>0</value>
    </item>
    </data>
     


    When I do this it gets only the first 'Case_id' of every item (1,1,1) and the first value (17,873,54):


    var itemReader = new Ext.data.XmlReader({
    record: 'item',
    idProperty: '@value_x',
    fields: [{name: 'date_value', mapping: '@value_x'},
    {name: 'value_case', mapping: 'value > @Case_id'},
    {name: 'value', mapping: 'value}]
    });



    If I do this other thing, it brings all of the 'Case_id', but none 'value' number:

    var itemReader = new Ext.data.XmlReader({
    record: 'value',
    fields: [{name: 'value_case', mapping: '@Case_id'},
    {name: 'value'}]
    });


    How can I get all this values?
    Thanks in advance!

  5. #15
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Are the number of cases in an item dynamic or are there always 1, 2, 3 and 4?

  6. #16
    Sencha User ronivcp's Avatar
    Join Date
    Jan 2010
    Location
    Argentina
    Posts
    29
    Vote Rating
    0
    ronivcp is on a distinguished road

      0  

    Default


    Quote Originally Posted by Condor View Post
    Are the number of cases in an item dynamic or are there always 1, 2, 3 and 4?
    Hi, condor!
    They are dynamic.

  7. #17
    Sencha User ronivcp's Avatar
    Join Date
    Jan 2010
    Location
    Argentina
    Posts
    29
    Vote Rating
    0
    ronivcp is on a distinguished road

      0  

    Default


    Those numbers depend on the info tag with the color cases,
    so, wath I need to get is:

    Dec 25, 2008:
    blue : 17
    green: 0
    purple: 1
    red: 2

    Jan 29, 2009:
    blue : 873
    green: 5
    purple: 0
    red: 0

    Feb 16, 2009
    blue : 54
    green: 5
    purple: 0
    red: 0

    colors may change and can be more or less than 4

  8. #18
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    You would end up with something like:
    Code:
    var valueReader = new Ext.data.XmlReader({
        record: 'value',
        idProperty: '@Case_id',
        fields: [
            {name: 'id', mapping: '@Case_id', type: 'int'},
            {name: 'value', mapping: '/', type: 'int'}
        ]
    });
    var itemReader = new Ext.data.XmlReader({
        record: 'item',
        idProperty: '@value_x',
        fields: [
            {name: 'date', mapping: '@value_x', type: 'date', dateFormat: 'M j, Y'},
            {name: 'values', mapping: '/', convert: function(v, n){
                return valueReader.readRecords(n).records;
            }}
        ]
    });
    var colorReader = new Ext.data.XmlReader({
        record: 'case',
        idProperty: '@id',
        fields: [
            {name: 'id', mapping: '@id', type: 'int'},
            {name: 'color', mapping: '@color', type: 'string'}
        ]
    });
    var colorStore = new Ext.data.Store({
        reader: colorReader
    });
    var itemStore = new Ext.data.Store({
        url: '...',
        reader: itemReader,
        listeners: {
            load: function(store){
                colorStore.loadData(store.reader.xmlData);
            }
        }
    });

  9. #19
    Sencha User ronivcp's Avatar
    Join Date
    Jan 2010
    Location
    Argentina
    Posts
    29
    Vote Rating
    0
    ronivcp is on a distinguished road

      0  

    Default


    Thanks a lot!!
    It works!
    But the thing is that I'm not quite sure how can I show this on a chart-series, with 'values' on the Yfield and 'date' on the Xfield.
    I want to show the colors on every day, so my idea is to show something like this (let's pretend this is a chart):


    20-| B R B
    10-| B PR G R B P
    0-| BGPR BGPR BGPR
    ---|---------------------------------
    DEC 25 JAN 29 FEB 16


    hardcoded using a json is like this:


    var store = new Ext.data.JsonStore({
    fields: ['Date', 'blue', 'green', 'purple', 'red'] ,
    data: [
    {Date: 'Dec 25, 2008', 'blue': 17, 'green': 3, 'purple': 1, 'red': 2},
    {Date: 'Jan 29, 2009', 'blue': 43, 'green': 5, 'purple': 4, 'red': 2},
    {Date: 'Feb 16, 2009', 'blue': 14, 'green': 4, 'purple': 3, 'red': 9}
    ]
    });


    var chart = new Ext.chart.ColumnChart({
    store: store,
    xField: 'Date',
    series:[
    {yField:'blue',displayName:'blue'},
    {yField:'green',displayName:'green'},
    {yField:'purple',displayName:'purple'},
    {yField:'red',displayName:'red'}
    ],
    extraStyle:{
    legend:{
    display: 'bottom'
    }
    }
    });




    I don't know how to fill this data with the stored one and how to set the yfield when I can't hardcode the name of the color.

  10. #20
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    You would need to use a reader like:
    Code:
    var itemReader = new Ext.data.XmlReader({
        record: 'item',
        idProperty: '@value_x',
        fields: [
            {name: 'Date', mapping: '@value_x', type: 'date', dateFormat: 'M j, Y'},
            {name: 'blue', mapping: 'value[Case_id=1]', type: 'int'},
            {name: 'green', mapping: 'value[Case_id=2]', type: 'int'},
            {name: 'purple', mapping: 'value[Case_id=3]', type: 'int'},
            {name: 'red', mapping: 'value[Case_id=4]', type: 'int'}
        ]
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar