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

List view data

2 Answers 31 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Joe Bohen
Top achievements
Rank 1
Joe Bohen asked on 20 Nov 2012, 12:05 PM
I have submitted this to Kendo which is probably the correct place please Delete this request.

I am new to Icenium (which I think is an excellent product) so
please bear with me if I have missed the obvious. I have implemented the fixed
headers listview using the code below taken from the Kendo Mobile demos. And I
would like to get to the data details would you look and let me know where I am
going wrong please.

Regards,

Joe

Data:

var groupedData = [

        { Jobnum:
"100234Col:1", CompanyName: "Ford Motors", description:
"Collect load From Crewe Ford .", url: "Images/Blue3.png",
JobType: "Collection" },

        {  Jobnum: "100235Del:1", CompanyName:
"Rolf GMBH", description: "Deliver Load to Intime Kerpen.",
url: "Images/Green1.png", JobType: "Delivery" },

         {  Jobnum: "100241Del:2", CompanyName:
"Asda", description: "Deliver Load to Asda Leicester.",
url: "Images/Green1.png", JobType: "Delivery" },

        {  Jobnum: "Fuel-021", CompanyName:
"ABC Services", description: "Fuel Fill Job.", url:
"Images/Yellow.png", JobType: "Fuel Fill" },

    ];

Template:

<script type="text/x-kendo-template"
id="listviewHeadersTemplate">

                                             <img
class="item-photo" src="${url}" />

                                             <h3
class="item">${Jobnum}</h3>

                                             <h3
class="item-compname">${CompanyName}</h3>

                                             <p
class="item-info">${description}</p> 

                                             <a
data-role="button" class="details-link"
href="stretchview">Details</a>

                                             <!--<li><a
href="tabstrip-geolocation">Detail</a></li>-->

                              </script>

Debug:



function listViewClick(e) {

     console.log(e.button); // Kendo mobile Button instance

    console.log(e.dataItem.item);

Uncaught TypeError:
Cannot read property 'item' of undefined

 }

 

2 Answers, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 21 Nov 2012, 12:35 PM
Hello Joe,

The e.dataItem return the object that you have bound the list to. So for you case you can use e.dataItem.CompanyName to get the company name property. Here is a small JS Bin that illustrates this for you example: http://jsbin.com/uyadat/1/edit

Hope this helps,
Stefan Dobrev
the Icenium team

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Joe Bohen
Top achievements
Rank 1
answered on 21 Nov 2012, 04:25 PM
Hi Stefan,

Thanks for your reply, It makes sense now.

Regards,
Joe
Tags
General Discussion
Asked by
Joe Bohen
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Joe Bohen
Top achievements
Rank 1
Share this question
or