From: Alan Knowles Date: Wed, 18 Aug 2021 10:37:49 +0000 (+0800) Subject: handle exception on store load if paging toolbar is used X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=5896f79b756bc39caf406ff84022e6e7a7204679 handle exception on store load if paging toolbar is used --- diff --git a/Roo/bootstrap/PagingToolbar.js b/Roo/bootstrap/PagingToolbar.js index 954d75f5e2..bde357542e 100644 --- a/Roo/bootstrap/PagingToolbar.js +++ b/Roo/bootstrap/PagingToolbar.js @@ -258,8 +258,14 @@ Roo.extend(Roo.bootstrap.PagingToolbar, Roo.bootstrap.nav.Simplebar, { }, // private - onLoadError : function(){ + onLoadError : function(o){ this.loading.enable(); + if (this.ds.events.loadexception.listeners.length < 2) { + // nothing has been assigned to loadexception except this... + // so + Roo.MessageBox.alert("Error loading",o.raw.errorMsg); + + } }, // private diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 5a6de038e5..8a2a9f65b1 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -28783,8 +28783,14 @@ Roo.extend(Roo.bootstrap.PagingToolbar, Roo.bootstrap.nav.Simplebar, { }, // private - onLoadError : function(){ + onLoadError : function(o){ this.loading.enable(); + if (this.ds.events.loadexception.listeners.length < 2) { + // nothing has been assigned to loadexception except this... + // so + Roo.MessageBox.alert("Error loading",o.raw.errorMsg); + + } }, // private diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 482a35b37e..2eaf80581e 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1218,8 +1218,8 @@ this.navgroup.parentId=this.id;this.navgroup.onRender(this.el,null);if(this.disp });},updateInfo:function(){if(this.displayEl){var A=(typeof(this.getCount)=='undefined')?this.ds.getCount():this.getCount();var B=A==0?this.emptyMsg:String.format(this.displayMsg,this.cursor+1,this.cursor+A,this.ds.getTotalCount());this.displayEl.update(B); }},onLoad:function(ds,r,o){this.cursor=o.params&&o.params.start?o.params.start:0;var d=this.getPageData(),ap=d.activePage,ps=d.pages;this.afterTextEl.dom.innerHTML=String.format(this.afterPageText,d.pages);this.field.dom.value=ap;this.first.setDisabled(ap==1); this.prev.setDisabled(ap==1);this.next.setDisabled(ap==ps);this.last.setDisabled(ap==ps);this.loading.enable();this.updateInfo();},getPageData:function(){var A=this.ds.getTotalCount();return {total:A,activePage:Math.ceil((this.cursor+this.pageSize)/this.pageSize),pages:A=1&parseInt(v,10)+B<=d.pages){this.field.dom.value=parseInt(v,10)+B;A=Math.min(Math.max(1,A+B),d.pages)-1;this.ds.load({params:{start:A*this.pageSize,limit:this.pageSize} });}e.stopEvent();}},beforeLoad:function(){if(this.loading){this.loading.disable();}},onClick:function(A){var ds=this.ds;if(!ds){return;}switch(A){case "first":ds.load({params:{start:0,limit:this.pageSize}});break;case "prev":ds.load({params:{start:Math.max(0,this.cursor-this.pageSize),limit:this.pageSize}