Treeview not working with Guid.ToString() as ID/ParentID

8 posts, 1 answers
  1. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 07 Jul Link to this post

    We have a simple Gantt chart, no dependencies, and are displaying tasks and subtasks.

    My treelist of task/sub-tasks is not working correctly. I am using Guid.ToString() for this value. If a Summary designation is given, I get treelist arrows, but parent/child relationships are not being honored. Removing Summary for top-level tasks then removes any UI elements for treelists. I'm wondering If I am missing some required CSS files. I have been using all.less and gantt.less, and even tried throwing in treelist.less, but to no avail.

    Any help and assistance is much appreciated. Let me know if you need further information.
  2. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 08 Jul Link to this post

    I switched the IDs to int.ToString and still no treelist functionality. I checked the data being passed to the Gantt control and the ParentID correctly corresponds to a proper parent in the list.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 08 Jul Link to this post

    Attached an image to show the problem. The ParentID of the TestCollections sub task is the ID for the Manage CUstomer Experience task, with an OrderId of 0. 
  5. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 08 Jul Link to this post

    I was able to get the treelist working by setting my DataSource as follows:

    .DataSource(d => d
                .ServerOperation(true)
                .Model(m =>
                {
                    m.Id(f => f.Id);
                    m.OrderId(f => f.OrderId);
                    m.ParentId(f => f.ParentId);
                })
                .Read(read => read
                    .Action("ReadTasks", "MyGanttController")
                )
            )

    Will try using Guid.ToString() again as this is working for ints.

  6. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 08 Jul Link to this post

    Got this working for ints as IDs when setting the DataSource on the Gantt as follows:

    .DataSource(d => d
                .ServerOperation(true)
                .Model(m =>
                {
                    m.Id(f => f.Id);
                    m.OrderId(f => f.OrderId);
                    m.ParentId(f => f.ParentId);
                })
                .Read(read => read
                    .Action("ReadTasks", "Capabilities")
                    .Data("GetFilterOptionValues")
                )
            )

     

    Will try with Guid.ToString() next.

  7. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 08 Jul in reply to James Link to this post

    Does not work with Guid.
  8. Answer
    Peter Milchev
    Admin
    Peter Milchev avatar
    144 posts

    Posted 11 Jul Link to this post

    Hello James,

    Setting the TaskId to be Guid should not be a problem. I should warn you that if you set the TaskId to be Guid, then the ParentId should be nullable Guid. Please find attached the controller, models and views I used to recreate your scenario. 

    Regards,
    Peter Milchev
    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
  9. James
    James avatar
    20 posts
    Member since:
    Feb 2015

    Posted 11 Jul in reply to Peter Milchev Link to this post

    Thanks, Peter.

    I did get it working after some trial and error this weekend, and it looks a lot like the solution you put forth. Thanks!

Back to Top
UI for ASP.NET MVC is VS 2017 Ready