Hello!! Here I am again with another prob… sorry…
I have a jsarray and I want to load it to my dataview…but it’s not happening. I tried the tutorial and modified it completely … but nothing… here’s what I got…
This array is in script.js -->var jsarray=new array(“Information1”, “Information2”, “Information3”);
//and this is where it all goes wrong… I think
function InitSites() {
//initializes Sites List
dataSites = new dhtmlXDataView({
container: "Div1",
type: {
template: "#data[0]#",//also tried "#data1#"
height: 56,
width: 420
}
});
dataSites.load("script.js","jsarray");
};
If you are loading from external js file it need to contain just an array data, no any extra code
script.js
["Information1", "Information2", "Information3"]
If you have script.js as in your post, and can’t change it - just include file on the page, as normal js file and use
dataSites.parse(jsarray,"jsarray"); //first parameter name of the jsarray var
Ok, so It’s actually loading the jsarray but the values come out “undefined” and they are strings. What am I supposed to put in the template… If I put “#data#” …undefined appears… If I put “#data1#” I get “#data1#”…
dhtmlxDataView\samples\03_loading\07_parse_array.html
type:{
template:"#data1# : #data2#<br/>#data3#",
height:40
}
Expected names are data0, data1, data2…
Thanks… but there might be a bug or something. with #data0# I get the first letter of the string in the array. ex array[0]=“Joseph” —#data0# =“j” #data1#=“o” and so on Is there a by pass… I really need to finish… and thanks a lot Stanislav!!
Can you try to change your original data as
[["Information1"], ["Information2"], ["Information3"]]
RESOLVED! Thanks Stanislav… The objects in my array were actually “pushed” at runtime so I changed the “push” to jsarray.push([item_to_add"]);
Thanks!!