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

[Solved] Detail View bind to datasource

6 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Start Informatica
Top achievements
Rank 1
Start Informatica asked on 08 Apr 2015, 10:45 AM

Hello,

 In your example:

http://dojo.telerik.com/IyOGA

how can i bind the <li> element to the column ShipName? It says it is not declared.

 

Thank you.

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 10 Apr 2015, 07:21 AM
Hi,

You are getting this error because the Employee object doesn't have a ShipName field. It is a member of the Order object.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Start Informatica
Top achievements
Rank 1
answered on 10 Apr 2015, 07:26 AM

I understand that, but how do i bind that <li> element to a member of the Order object?

I just want it like this:

<div class='employee-details'>
                            <ul>
                                <li><label>Country:</label>#= Country #</li>
                                <li><label>City:</label>#= City #</li>
                                <li><label>Address:</label>#= Address #</li>
                                <li><label>Home Phone:</label>#= HomePhone #</li>
                                <li><label>Ship Name:</label>#= ShipName #</li>
                            </ul>
                        </div>

 

 

 

0
Atanas Korchev
Telerik team
answered on 14 Apr 2015, 06:40 AM
Hello,

You can't bind to a member of the Order object because no order has been loaded at the time when detailInit fires. You have to wait for Orders to load before using them.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Start Informatica
Top achievements
Rank 1
answered on 14 Apr 2015, 07:32 AM
What event is called when the datasource finished loading?
0
Start Informatica
Top achievements
Rank 1
answered on 14 Apr 2015, 07:36 AM

Looking at the datasource events i found this one:

function onDataBound(arg) {
                    kendoConsole.log("Grid data bound");
                }

But, how exactly can i bind my html element here? Thank you.

0
Atanas Korchev
Telerik team
answered on 15 Apr 2015, 06:59 AM
Hi,

You should use jQuery if you want to bind the HTML asynchronously. Handle the detailInit event:

detailInit: function(e) {
    var datailCell = e.detailCell;
    
    var dataSource = new kendo.data.DataSource({ 
           transport: {/* transport configuration */}
    });
 
    dataSource.fetch(function() {
           var firstDataItem = dataSource.at(0);
           
           // use jQuery to find particular DOM element from the detailCell

           $(detailCell).find("li").text(firstDataItem.ShipName);
    });
}

I have also updated your demo: http://dojo.telerik.com/@korchev/iboha

Regards,
Atanas Korchev
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
Start Informatica
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Start Informatica
Top achievements
Rank 1
Share this question
or