Search code examples
javascriptextjs4sencha-touch

Sencha Extjs Value not binding


I'm using Sencha ExtJS.I want to get all values in a single div rather than multiple.I tried for a code

` window.setInterval(function () {
                me.updateData({
                    Name: "aaa, aaa",
                    Id: "1234",
                    Vitals: [{
                        Name: "value1",
                        Timestamp: new Date(),
                        Value: getRandomInt(60, 80) + "/" + getRandomInt(60, 80)
                    }, {
                        Name: "value2",
                        Timestamp: new Date(),
                        Value: getRandomInt(60, 80)
                    }, {
                        Name: "value3",
                        Timestamp: new Date(),
                        Value: getRandomInt(60, 80)
                    }, {
                        Name: "value4",
                        Timestamp: new Date(),
                        Value: getRandomInt(60, 80)
                    }
                    ]
                });              
            }, 1000);


        items: [            
        {
            itemId: 'value_sys'   
        },
        {               
            items: [
            {                    
                itemId: 'value1'                   

                , tpl: '<div>{Value}</div>'   //value1 value here
            },{
                itemId: 'value2',
                tpl: '<div>{Value}</div>'    //value2 value here
            }, 
            {
                itemId: 'value3',
                tpl: '<div>{Value}}</div>'   //value3 value here
            }, 
            {
                itemId: 'value4',
                tpl: '<div>{Value}</div>'    //value4 value here
            }
            ]}
            ]`

Above code working fine, But i need to change the existing behavior to get all values in a single div like

items: [            
        {
            itemId: 'value_sys'   
        },
        {               
            items: [
            {                    
                itemId: 'value1,value2,value3,value4'                   

                , tpl: '<div>{Value}</div>'   //value1,value2,value3,value4 value here
            }
            ]}

Is this correct ? Can anyone help me by pointing me to the right direction? Any tutorial, or blog post would be very helpful

Thank you


Solution

  • You may use for-loop here:

    '<div>',
        '<tpl for="Vitals">',
            '<tpl>{Value} </tpl>',
        '</tpl>',
    '</div>'
    

    working example https://fiddle.sencha.com/#fiddle/1rt4