lundi 13 avril 2015

Need syncronous messagebox within a beforechange event in pagingtoolbar

Hi,



Within a grid I want to display a messagebox warning when rows are selected and a page up or down is requested. If the user requests to stay on the page it shouldn't reload with the new page.



The messagebox displays but then continues with the paging request. Don't know if this is possible but figured I'd ask. Here's the code for the pagingtoolbar.



Code below

{

xtype: 'pagingtoolbar',

dock:'bottom',

store: 'AMSProductGroups.store.details.DetailsStore',

displayInfo: true,

displayMsg: i18n.text.DisplayText,

emptyMsg: i18n.text.EmptyText,

listeners: {





'beforechange': function(me, page, eOpts) {





var grid = Ext.ComponentQuery.query('#detailsWindow grid[itemId="detailsGrid"]');

var arraySelected = grid[0].getSelectionModel().getSelection();

if (arraySelected.length != 0) {





Ext.MessageBox.confirm({

title : 'Changes will be lost',

msg : "You've requested a different page number, you're unprocessed selections will be lost <br><br>Do you want to continue?",

buttons : Ext.MessageBox.YESNO,

//modal: true,

fn : function(btn) {

if(btn == 'yes') {

return true;

} else {

return false;

}

},

icon : Ext.MessageBox.QUESTION,

scope: this

});





}

}

}

}





Need syncronous messagebox within a beforechange event in pagingtoolbar

Aucun commentaire:

Enregistrer un commentaire