Kendo Grid for child element of parent child relationship

2 posts, 0 answers
  1. Dawn
    Dawn avatar
    2 posts
    Member since:
    Apr 2016

    Posted 17 Oct Link to this post

    I really hope someone can assist me.  I am new to MVC and Telerik Controls.  I have use the Jquery version of the Telerik Grid to display lists of parent data from my database and implemented server paging/sorting etc and this has gone well so far.

    I have a list of Issues and when an item is double clicked, an issue detail view is opened (this is a razor view, with additional information to display to that contained in the grid).  I have done this by implementing a jquery call on the double click of the kendo grid. (If there is a nicer way to do this using the popup mode please could someone let me know as I found popup mode relied on the data available to the grid??)

    The issue detail view need to present a list of all issue comments related to the issue and allow adding/editing and removing of them.

    I would like to use the kendo grid for this list too as their may be a lot of comments and I would like to implement paging for them.

    I have EF as my data layer with unit of work and repository pattern and a business layer with business models.  I am then translating to View models and currently I have an Issue view model with a List<IssueCommentsVM> property populated.

    However, I am currently getting the data for IssueComments via the grids read operation to a 'GetIssueComments' action on the controller.

    Issues I am having:-

    - I need to be able to create a new issue and add multiple issue comments to the grid and save both the issue and the issue comments entered at the same time

    - When editing an issue, there may be a lot of comments, so I would like server side paging/filtering/sorting implemented, but when I change the page/filter etc, my edits will be lost??

    Is there a good way of getting the kendo grid to add/edit and delete Issue Comments in bulk edit style way, maintaining state if pages are changed or filtering is applied so that when they save the Parent Issue, the child Issue Comment changes are all passed to the Issue Save action method.

    I was thinking maybe there is a way to bind the grid to the parent models child data List<IssueCommentVM> and getting add/edit/delete to post and update this model and refresh the page and hence child grid, but then how would I handle paging etc as I don't want to return all comments to the parent model, just the requested page, but I still need to save changes.

    Can anyone help me out, this seems so complicated, there has to be something I am missing in my understanding.

     

  2. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 19 Oct Link to this post

    Hi Dawn,

    As far as I understand you need a grid with popup editing functionality where the edit template will have another grid with enabled Batch editing. If that is your requirement you can check out the following sample which demonstrates how to achieve that. You should note that the changes will be persisted when you change the page but the dirty indicator will be removed. In case you want to show it you need to manually persist it as described in the following help article. However, you should note that the changes will not be persisted if you are using a server paging. In such case you can show a message that the changes need to be saved before proceeding to the next page.

    I hope this information helps.

    Regards,
    Kostadin
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Kendo UI is VS 2017 Ready
Back to Top