Search code examples
extjsextjs4extjs4.1extjs4.2extjs-mvc

ExtJS 4.2 dataview - how to know if item is selected


HI I have a DataView with XTemplate.

In my controller, I listen to the itemclick event.

onItemClick: function(view, record, item) {
        var me = this,
            panel = me.getRightPanel();

        // here I need to know if the item clicked is already selected

}

Is there a way to know if the item clicked is already selected?


Solution

  • You could call getSelectionModel on your DataView object and then call getSelection on the result. This would give you an array of Model objects. After that, just check if object record (the parameter to onItemClick) is in the array.