PDA

View Full Version : Why DataView only refresh the first field tag repeated?



jjalonso
30 Nov 2011, 3:29 PM
Hello, i have a DataView but my XTemplate have two references to a field tag: {food} {food}

This is my test case:



<!DOCTYPE html> <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link src="http://dev.sencha.com/deploy/touch/resources/css/sencha-touch.css" rel="styleshet">
<script src="http://dev.sencha.com/deploy/touch/sencha-touch.js" type="text/javascript"></script>
<script>
var demoApp = new Ext.Application({
launch: function() {
Ext.regModel('Product', {
fields: [
"food"
]
});

this.Cart = new Ext.DataView({
store: new Ext.data.Store({
model: "Product",
data : [
{food: 'Lettuce'},
],
proxy: {
type: 'memory',
reader: {
type: 'json',
root: ''
}
},
autoLoad:true
}),
tpl: new Ext.XTemplate('<tpl for="."><span class="test">You buy {food}</span><br/><span class="test">You buy {food}</span></tpl>'),
fullscreen: true,
itemSelector:'span.test',
});
this.panel = new Ext.Panel({
fullscreen: true,
items: [ this.Cart, ],
});
this.Cart.store.sync();
}
});
</script>
</head>
<body>
</body>
</html>

The starting page show:
You buy Lettuce
You buy Lettuce

Later i want update the food field in the model.
RUN in browser console: demoApp.Cart.store.getAt(0).set('food', 'Cat');

The ending page show:
You buy Cat
You buy Lettuce

PROBLEM: Why DataView only refresh the FIRST field tag?.

mitchellsimoens
1 Dec 2011, 8:41 AM
Odd... not seeing this in Ext JS 4 or ST2... haven't ever tried having the same field more than once in ST1

jjalonso
1 Dec 2011, 12:53 PM
Really dont know why this occurs because Xtemplate dont have this limitation. I test it.

Waiting reply.
Juan Jose Alonso.