Detail template refresh

9 posts, 0 answers
  1. William
    William avatar
    5 posts
    Member since:
    Jul 2012

    Posted 24 Mar 2016 Link to this post

    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.

  2. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 28 Mar 2016 Link to this post

    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!
     
  3. William
    William avatar
    5 posts
    Member since:
    Jul 2012

    Posted 28 Mar 2016 in reply to Kostadin Link to this post

    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?
  4. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 30 Mar 2016 Link to this post

    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!
     
  5. William
    William avatar
    5 posts
    Member since:
    Jul 2012

    Posted 30 Mar 2016 in reply to Kostadin Link to this post

    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.

  6. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 04 Apr 2016 Link to this post

    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!
     
  7. William
    William avatar
    5 posts
    Member since:
    Jul 2012

    Posted 04 Apr 2016 in reply to Nikolay Rusev Link to this post

    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?

  8. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 06 Apr 2016 Link to this post

    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!
     
  9. William
    William avatar
    5 posts
    Member since:
    Jul 2012

    Posted 06 Apr 2016 in reply to Nikolay Rusev Link to this post

    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.
Back to Top