This is a migrated thread and some comments may be shown as answers.

Array within an array

1 Answer 6 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JJ
Top achievements
Rank 1
JJ asked on 25 Dec 2013, 04:09 PM
I'm using a JavaScript version of the MultiSelectInGrid example. Based on the example, an Employee belongs to multiple Territories. I want to add an association where each Territory belongs to multiple Regions. I'm trying to display Employees, Territories and Regions in a single grid. 

The following template works when trying to display the name of each Territory:
<script type="text/kendo" id="territoriesTemplate">
<ul>
    #for(var i = 0; i < Territories.length; i++){#
        <li>#:Territories[i].TerritoryName#</li>
    #}#
</ul>
</script>
This function is being used to display the array in a readable format within the grid:
function serializeArray(prefix, array, result) {
for (var i = 0; i < array.length; i++) {
    if ($.isPlainObject(array[i])) {
        for (var property in array[i]) {
            result[prefix + "[" + i + "]." + property] = array[i][property];
        }
    }
    else {
        result[prefix + "[" + i + "]"] = array[i];
    }
  }
}
I've tried the template below but I can only see '[object Object]' in the column.  Any idea how I can get it to work?
<script type="text/kendo" id="territoriesTemplate">
<ul>
    #for(var i = 0; i < Territories.length; i++){#
        <li>#:Territories[i].Regions#</li>
    #}#
</ul>
</script>

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 26 Dec 2013, 09:10 AM
Hi J,

I already answered to this query in duplicated support ticket created by you - #770985 . Please keep in mind that it is highly recommended that you keep related questions in one support thread or a forum post, so that we can easily keep track of your support history and provide better answers in a shorter time.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
JJ
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or