-
10 Jul 2012 3:26 AM #1
How to combine confirm MessageBox with beforeselect event on treegrid?
How to combine confirm MessageBox with beforeselect event on treegrid?
I'm facing a problem that i need to ask user for an action when he switches from node to node on treegrid, i'm using beforeselect event within controller and Ext.MessageBox.confirm, so after user pushes the button on messagebox i need to be able select the node he wanted to select or cancel the selection. My problem is that confirm message passes the node to be selected, i can't return false because beforeselect event function works behind the messagebox. Does anyone know how to make it working ?
-
10 Jul 2012 4:04 AM #2
Hi!
may you provide your code so i may take further action for your problemsword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
10 Jul 2012 4:15 AM #3
yes, sure
Code:this.control({ 'treepanel[id="my-tree"]': { beforeselect: function(view, record, index, options) { var check = this.makeCheck(); var out = false; //or true - depends on question in alert if(check){ Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', function(btn){ out = true; //or false - depends on question in alert }, this); } return out; } }
-
10 Jul 2012 4:26 AM #4
HI!
try this:-
Code:beforeselect: function(view, record, index, options) { var check = this.makeCheck(); if(check){ Ext.MessageBox.confirm( 'Confirm' , 'Are you sure you want to do that?' , function (btn) { if (btn == 'yes') { // do what ever you want here... } } ); } }sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
10 Jul 2012 4:37 AM #5
suppose after pressing yes button i want to cancel selection, how can i do that? if i return false after i check yes button it doesn't work, treegrid revices nothing(that means that row can be selected) before user takes an action and press Yes button
-
10 Jul 2012 4:42 AM #6
sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.
-
10 Jul 2012 4:44 AM #7
-
10 Jul 2012 4:49 AM #8
yes, but it doesn't work that way ... that is question!
-
10 Jul 2012 4:49 AM #9sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

-
10 Jul 2012 4:53 AM #10
it should work, have you checked API Docs?
beforeselect( Ext.selection.RowModel this, Ext.data.Model record, Number index, Object eOpts )
Fired before a record is selected. If any listener returns false, the selection is cancelled.
sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.


Reply With Quote