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

Detail template refresh

8 Answers 847 Views
Grid
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 24 Mar 2016, 09:33 PM

I am using the grid with a details template.The data is remote and the data set is large. The method that populates the grid is only going to give me a subset of that data. Upon expansion, I want to query for the full data for each particular record. The schema stays the same. This is what I have so far in the detailInit function.

 

function detailInit(e) {
    var detailRow = e.detailRow;
    var defaultData = e.data;
    $.ajax({
        type: "GET",
        url: urlBase + "candidatesearch/" + e.data.CandidateId,
        contentType: 'application/json',
        dataType: 'json',
        success: function (data) {
            kendo.bind(detailRow, data);
            detailRow.find(".tabstrip").kendoTabStrip({
                animation: {
                    open: { effects: "fadeIn" }
                }
            });
        },
    });
}

Everything seems to go fine. The event is fired, the data is retrieved but I cannot figure out a way to tell my template to refresh/rebind with the fully retrieved data. What am I missing?

 

Thank you in advance for your help.

8 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 28 Mar 2016, 08:53 AM
Hi William,

Thank you for contacting us.

I examined the provided code and as far as I can see you are retrieving the value but you are not actually bind it to the grid. I would recommend you to examine the following live example which demonstrates how to create a hierarchical grid. Generally on detailInit event handler you are creating a new kendo grid which is populated with the detail data. I would suggest you to try this approach and let me know about the result.

I am looking forward to your reply.


Regards,
Kostadin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
William
Top achievements
Rank 1
answered on 28 Mar 2016, 01:01 PM
Thank you for your reply. I'm familiar with that example, however, I do not want another grid. I was looking for a better approach. Is the grid the only way to get new data bound?
0
Kostadin
Telerik team
answered on 30 Mar 2016, 06:47 AM
Hi William,

In case you need to display the data in a tabular format then I would recommend you to use another kendo grid. Nevertheless, you can use any Kendo Widget or an html element to visualize the data. 

Regards,
Kostadin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
William
Top achievements
Rank 1
answered on 30 Mar 2016, 12:35 PM

Thanks for the reply. I don't think I'm being clear. My detail view is not tabular, it's not a grid and I don't want it to be a grid. If I did, I know how to make that work.

I understand that I can use any Kendo Widget to visualize details. That also works. The problem is that my details view needs to fetch a lot more data from the server to be meaningful. The call to my server to fetch succeeds and I call kendo.bind on the detail row with my newly fetched data (see code from my first post), but it's never rebinded. Perhaps this isn't supported or I'm going about it wrong. This is what I'm asking for guidance on.

Thank you again.

0
Nikolay Rusev
Telerik team
answered on 04 Apr 2016, 06:40 AM

Hello William,

 

There is a detailInit event triggered once for every detail row when expanded for the first time. You can use this event to gather required data and build the UI for the detail template. 

 

There is an online example  which demonstrates how to buid the UI in that event.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
William
Top achievements
Rank 1
answered on 04 Apr 2016, 01:43 PM

As you can see from my initial post, I *AM* using the detailinit function and I've also stated that I do not want a grid within a grid. You're the second person to recommend the sample that I said I saw several times. Either I'm missing something very fundamental or you're not understanding my request. Either way, this is becoming very frustrating.

If a grid within a grid is the only way possible to rebind after loading data asynchronously, I will attempt to use that as a workaround.

My question is, why does the code in my very first post not rebind. Is this not supported or am I doing something wrong?

0
Nikolay Rusev
Telerik team
answered on 06 Apr 2016, 07:51 AM

Hello William,

 

`As you can see from my initial post, I *AM* using the detailinit function and I've also stated that I do not want a grid within a grid. You're the second person to recommend the sample that I said I saw several times. Either I'm missing something very fundamental or you're not understanding my request. Either way, this is becoming very frustrating.` - Indeed the example is linked twice in this thread. It demonstrates the fundamentals of how to initialize any widget inside Grid detail template. It doesn't have to be another Grid. As you can see there is also a TabStrip and a plain HTML elements bound to the data from the item. I believe you should be able to implement this in your project as well.

 

`If a grid within a grid is the only way possible to rebind after loading data asynchronously, I will attempt to use that as a workaround.` - No, it is not the only option. It is a template so that the developer can place any content, see the previous above.

 

`My question is, why does the code in my very first post not rebind. Is this not supported or am I doing something wrong?` - I'm not sure why is not working in your project. I've prepared an example bellow which seems to operate correctly. 

 

http://dojo.telerik.com/@rusev/eGeDE

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
William
Top achievements
Rank 1
answered on 06 Apr 2016, 01:31 PM
Thank you so much. This is what I needed. It appears the difference is that I was using a template where I was referencing fields with the # syntax (ex: #= Name#) when I needed to be using data-bind attribute. I just wasn't sure if what I was trying to accomplish was possible with your framework, but it is and I'm delighted. Thank you again.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
William
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or