I have json data array (shown below) and would like to display in Mobile ist View Control, something like this:
data-item-template="<div> <span> array element 1</span> <span>array element 2 </span> </div>"
Note: I have simplified to understand problem, data displayed is very complex and around 50 array elements.
Json Data:
{
"browseData": [
[
"10S10010",
"10C1000",
"Z"
],
"SO011203",
"A"
]
}
Hi annasaheb,
Thank you for posting in the community.
I have researched this scenario and it seems that in this scenario the json properties should not contain arrays as it would not be possible to access their respective items (as templating counts on property access). More on accessing properties can be found at:
http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=igListView_Adding_igListView_to_a_Web_Page.html
var source = [{parent : [ "1", "2"]}]
would become
var source = [ {"parent":"1"}, {"parent":"2"} ]
var source = [
{"parent":"1"},
{"parent":"2"}
Afterwards this would be displayable in your template using something like:
data-item-template="<div> <span> ${parent} </span> <span> </span> </div>"
Please feel free to contact me if you have any questions.
Thanks for the answer, I might have to add label to each array data. I can live with that. but now as I need to build generic data item template in Javascript, how can I do it? following code shows "There are no list items!", If I assign datasource & itemTemplate in html, it works fine.
HTML:
<ul id="templateListView"
data-role="iglistview"
</ul>
BLOCKED SCRIPT
$(window).load(function (){
//Initialize
$(".templateListView").igListView({
dataSource: "brData",
itemTemplate: "<div><h2>${f0}</h2><p>${f1}</p></div>"
});
$(".templateListView").igListView("dataBind");