Select based on dataItems instead of selectors

2 posts, 0 answers
  1. Miguel
    Miguel avatar
    15 posts
    Member since:
    Jul 2014

    Posted 26 Aug 2014 Link to this post

    I'm selecting some items programmatically by using It works fine, but I find the restriction to only select based on DOM elements (or jQuery expressions) a bit restrictive. This is important specially when using frameworks like Ember or patterns like MVVM where you work with the data and not directly with the DOM. I have the following code to make it work, but it would be nice if I could just call'selectedMedication') instead of having to find the corresponding element myself. Any idea if that's possible? 

     var kendoGridObject = this.get('kendoGridObject'),
                selectedMedication = this.get('selectedMedication'),
                dataItems = kendoGridObject.dataItems(),
                selectedDataItem = dataItems.findBy('_originalObject', selectedMedication),
                selector = 'tr[data-uid="' + selectedDataItem.uid + '"]';
            // finally from the data-uid we have our jquery selector

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2304 posts

    Posted 28 Aug 2014 Link to this post

    Hello Miguel,

    By design the Grid selection operates only over DOM elements. Indeed using the uid property of the items and retrieving the corresponding row is the correct workaround in the current scenario.

    Dimiter Madjarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top