Listbox Reordering

2 posts, 0 answers
  1. Owen
    Owen avatar
    4 posts
    Member since:
    Sep 2014

    Posted 18 Apr 2018 Link to this post

    I hope someone can help me with is. I used the basic usage example (from the demo page) and built upon this to be able to read data from my database and then capture both lists in my controller. List two works as expected, however when re-ordering list one, the list item index remains the same. 


                                .DataSource(source => source
                                        .Read(read => read.Action("_GetAvailableDashboardItems_ListOne", "Home"))
                                .Toolbar(toolbar =>
                                    toolbar.Tools(tools => tools
                                .Events(events => events
                                .DataSource(source => source
                                        .Read(read => read.Action("_GetAvailableDashboardItems_ListTwo", "Home"))



    public JsonResult _GetAvailableDashboardItems_ListOne()
                var items = _userTask.GetAvailableDashboardItems(CurrentUserId, false);
                return Json(items, JsonRequestBehavior.AllowGet);
     public JsonResult _GetAvailableDashboardItems_ListTwo()
                var items = _userTask.GetAvailableDashboardItems(CurrentUserId, true);
                return Json(items, JsonRequestBehavior.AllowGet);



    public IEnumerable<AvailableDashboardItems> GetAvailableDashboardItems(string userId, bool Region)
                var userItems = _userRepository.GetUserDashboardItems(userId);
                if (userItems.Count() != 0)
                    var items = userItems.Where(x => x.Region == Region).OrderBy(x => x.Position);
                    return Mapper.Map<IEnumerable<UserDashboardItem>, IEnumerable<AvailableDashboardItems>>(items);
                    if (!Region)
                        return Mapper.Map<IEnumerable<DashboardItem>, IEnumerable<AvailableDashboardItems>>(_userRepository.GetAvailableDashboardItems());
                return null;


    Any help would be greatly appreciated, Thanks 


  2. Stefan
    Stefan avatar
    2786 posts

    Posted 20 Apr 2018 Link to this post

    Hello, Rich,

    Thank you for the details.

    This is expected as the ListBox will not automatically update the dataSource indexes of the reordered items by design.

    We have an article demonstrating how the indexes can be updated on the reorder event:

    I hope this is helpful.

    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top