html - ExtJS: data[root].slice is not a function error after adding tpl and store to dataview -


I have a template, a store and a simple dataview in which I add the store and tepele. I'm unable to run it and get the following error: data [root]. Slice function is not there.

Thanks Mera Bella

Thank you.

Your store was in the wrong format, when your model is already stable, you are not a dynamic column Can create.

This should fix your problems:

  var store = Ext.create ("Ext.data.Store", {fields: ["VAL", "HEAT "], Auto-load: true, proxy: {type:" ajax ", url:" data 1. jason ", reader: {type:" jason ", root:" data. Rows "}}}); Var myTpl = new Ext.XTemplate ('& lt; Table border = "1px" border-color = "# 444444" width = "100%" & gt;', '& lt; tr & gt;', '& lt ; Th> Val & lt; / Th>; ',' th & gt; HEAT & lt; / th & gt; ',' & lt; / tr & gt; ', & lt; Tpl for = "." & Gt; ',' & lt; tr & gt; ',' & lt; td align = "center" & gt; {VAL} & lt; / td & gt; & # 39; & # 39; & lt; ; Td align = "center"> {HEAT} & lt; / td & gt; ',' & lt; / tr & gt; ',' & lt; / tpl & gt; ',' & lt; / Table & gt; '); Var dataview = Ext.create ("Ext.view.View", {store: store, tpl: myTpl, item selector: "", Render: Ext.getBody ()});  

and your data1.json

  {"data": {"COLUMNS": ["column 1", "column2", "column 3 "", "RA1C1", "RA1c1", "hit": 1}, {"val": "r1c2", "hit": 3}, {"val": "r 1C3 "," "R2C1", "HEAT": 1}, {"VAL": "R2C2", "HEAT": 1}, {"VAL": "R2C3", "HEAT" : 4}]}}  

Comments