DataUpdate.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. Ext.QuickTips.init();
  2. Ext.define('erp.controller.ma.update.DataUpdate', {
  3. extend : 'Ext.app.Controller',
  4. requires : ['erp.util.GridUtil', 'erp.util.BaseUtil'],
  5. views : [ 'ma.update.DataUpdate', 'core.toolbar.Toolbar' ],
  6. init : function() {
  7. var me = this;
  8. me.GridUtil = Ext.create('erp.util.GridUtil');
  9. me.BaseUtil = Ext.create('erp.util.BaseUtil');
  10. this.control({
  11. '#updategrid':{
  12. afterrender : function(f) {
  13. f.addGrid= function(){
  14. me.createGrid(this, Ext.getCmp('scheme_id_').value,Ext.getCmp('scheme_id_').rawValue, true);
  15. };
  16. }
  17. },
  18. 'button[name=import]' : {
  19. click : function(btn) {
  20. me.onQueryClick();
  21. },
  22. afterrender : function() {
  23. Ext.defer(function(){
  24. me.onQueryClick();
  25. }, 500);
  26. }
  27. },
  28. 'button[id=checkupdate]':{
  29. click:function(btn){
  30. if(btn.activeItem.itemIndex==1)me.checkData();
  31. else me.updateData();
  32. }
  33. },
  34. 'button[name=history]' : {
  35. click : function(btn) {
  36. me.history();
  37. }
  38. },
  39. 'button[name=close]' : {
  40. click : function() {
  41. if (parent.Ext && parent.Ext.getCmp('content-panel')) {
  42. parent.Ext.getCmp('content-panel').getActiveTab().close();
  43. } else {
  44. window.close();
  45. }
  46. }
  47. },
  48. 'button[name=downloadError]' : {
  49. click : function() {
  50. grid=Ext.getCmp('updategrid-data');
  51. window.location = basePath + 'ma/update/exportErrorExcel.xls?id=' +grid.ulid+'&title='+encodeURI(encodeURI("错误数据")) ;
  52. }
  53. }
  54. });
  55. },
  56. onQueryClick : function() {
  57. var me = this, win = me.querywin;
  58. if (!win) {
  59. var form = me.createQueryForm(), temp = me.createTempForm();
  60. win = me.querywin = Ext.create('Ext.window.Window', {
  61. closeAction : 'hide',
  62. closable:false,
  63. title : '选择更新方案',
  64. height: 500,
  65. width: 800,
  66. id:'scheme-win',
  67. layout: 'anchor',
  68. modal: true,
  69. items : [form, temp],
  70. buttonAlign : 'center',
  71. buttons : [{
  72. text : '查看历史',
  73. iconCls: 'history',
  74. cls : 'x-btn-gray',
  75. height : 26,
  76. width : 100,
  77. handler : function(b) {
  78. me.history();
  79. }
  80. },{
  81. text : '下载模板',
  82. iconCls: 'x-button-icon-excel',
  83. cls : 'x-btn-gray',
  84. height : 26,
  85. width : 100,
  86. handler : function(b) {
  87. me.exportExcel();
  88. }
  89. },{
  90. xtype: 'form',
  91. height : 26,
  92. width : 100,
  93. bodyStyle : 'background: transparent no-repeat 0 0;border: none;',
  94. items : [ { xtype : 'filefield',
  95. name : 'file',
  96. buttonOnly : true,
  97. hideLabel : true,
  98. buttonConfig : {
  99. iconCls : 'x-button-icon-excel',
  100. cls : 'x-btn-gray',
  101. width : 100,
  102. height : 26,
  103. text : $I18N.common.button.erpUpExcelButton
  104. },
  105. listeners : {
  106. change : function(field) {
  107. me.importData(field);
  108. }
  109. }} ],
  110. }, {
  111. text : $I18N.common.button.erpCloseButton,
  112. height : 26,
  113. width : 100,
  114. cls : 'x-btn-gray',
  115. handler : function(b) {
  116. if(!Ext.getCmp('updategrid-data')){
  117. Ext.getCmp('history').setDisabled(true);
  118. Ext.getCmp('checkupdate').setDisabled(true);
  119. }
  120. b.ownerCt.ownerCt.hide();
  121. }
  122. }]
  123. });
  124. }
  125. win.show();
  126. },
  127. createQueryForm:function(){
  128. var me = this;
  129. var form = Ext.create('Ext.form.Panel', {
  130. region: 'center',
  131. anchor: '100% 10%',
  132. layout: 'column',
  133. autoScroll: true,
  134. defaults: {
  135. columnWidth: 1,
  136. margin: '4 8 4 8'
  137. },
  138. bodyStyle: 'background:#f1f2f5;',
  139. items:[{
  140. xtype:'combo',
  141. flex:1,
  142. fieldLabel:'更新方案',
  143. allowBlank:false,
  144. name:'scheme_id_',
  145. id:'scheme_id_',
  146. listConfig:{
  147. maxHeight:180
  148. },
  149. store: schemeStore,
  150. displayField: 'title_',
  151. valueField: 'id_',
  152. queryMode: 'local',
  153. editable:false,
  154. triggerAction : 'all',
  155. listeners: {
  156. afterRender : function(combo) {
  157. if( schemeStore.getAt(0)!=null){
  158. var firstValue = schemeStore.getAt(0).get('id_');
  159. combo.setValue(firstValue);
  160. me.getUpdateDetail(firstValue);}
  161. },
  162. select: function (combo, record, index) {
  163. me.getUpdateDetail(record[0].data.id_);
  164. }
  165. }
  166. }]
  167. });
  168. return form;
  169. },
  170. createTempForm : function() {
  171. var me = this;
  172. return Ext.create('Ext.form.Panel', {
  173. id: 'temp',
  174. title: '可修改信息',
  175. anchor: '100% 90%',
  176. bodyStyle: 'background:#f1f1f1;',
  177. autoScroll : true,
  178. items:[
  179. { id: 'tempContainer',
  180. xtype: 'fieldcontainer',
  181. defaultType: 'checkboxfield',
  182. items: [],
  183. layout:'column',
  184. fieldDefaults: {
  185. margin: '3 10 3 10'
  186. }
  187. }]
  188. });
  189. },
  190. getUpdateDetail:function(id){
  191. var me = this;
  192. Ext.Ajax.request({
  193. url : basePath + 'ma/update/getUpdateDetail.action',
  194. params: {
  195. id: id,
  196. },
  197. method : 'post',
  198. callback : function(options,success,response){
  199. var res = new Ext.decode(response.responseText);
  200. if(res.exception || res.exceptionInfo){
  201. showError(res.exceptionInfo);
  202. return;
  203. }
  204. if(!res.success){
  205. return;
  206. } else {
  207. me.indexfields = res.indexfields;
  208. me.updatedetails = res.updatedetails;
  209. schemeDetails=me.indexfields.concat(me.updatedetails);
  210. var b=me.indexfields,d = me.updatedetails, mainitems = new Array();
  211. if(b && b.length > 0) {
  212. Ext.each(b, function(i){
  213. mainitems.push({
  214. xtype: 'checkbox',
  215. name: i.field_,
  216. boxLabel:i.caption_!='null'?'<font color=red>'+i.caption_+'</font>':'<font color=red>'+i.field_+'</font>',
  217. checked:true,
  218. columnWidth: 0.25,
  219. readOnly:true
  220. });
  221. });
  222. }
  223. if(d && d.length > 0) {
  224. Ext.each(d, function(i){
  225. mainitems.push({
  226. xtype: 'checkbox',
  227. name: i.field_,
  228. boxLabel: i.caption_,
  229. columnWidth: 0.25,
  230. checked:i.checked_
  231. });
  232. });
  233. }
  234. Ext.getCmp('tempContainer').removeAll();
  235. Ext.getCmp('tempContainer').add(mainitems);
  236. Ext.getCmp('temp').doLayout(true);
  237. }
  238. }
  239. });
  240. },
  241. exportExcel:function(){
  242. var me=this;
  243. var items = Ext.getCmp('tempContainer').items.items;
  244. var checked = new Array();
  245. Ext.each(items,function(item){
  246. if(!item.readOnly && item.checked)checked.push(item.name);
  247. });
  248. if (checked.length!=0){
  249. window.location = basePath + 'ma/update/exportExcel.xls?id=' + Ext.getCmp('scheme_id_').value +
  250. '&title=' + (Ext.getCmp('scheme_id_').rawValue)+'&checked='+unescape(checked);
  251. }else showError("请选择待更新的字段");
  252. },
  253. importData:function(field){
  254. var me=this;
  255. var bool = field.ownerCt.fireEvent('beforeimport', this);
  256. if (bool != false) {
  257. field.ownerCt.getForm().submit({
  258. url: basePath + 'ma/update/importData.action?id=' + Ext.getCmp('scheme_id_').value,
  259. waitMsg: "正在解析Excel",
  260. success: function(fp, o){
  261. field.reset();
  262. me.createGrid(Ext.getCmp('updategrid'), Ext.getCmp('scheme_id_').value,Ext.getCmp('scheme_id_').rawValue, true);
  263. Ext.getCmp('updategrid-data').ulid = o.result.ulid;
  264. Ext.getCmp('updategrid-data').down('pagingtoolbar').dataCount = o.result.count;
  265. Ext.getCmp('updategrid-data').down('pagingtoolbar').onLoad();
  266. Ext.getCmp('updategrid-data').getGridData(1);
  267. Ext.getCmp('checkupdate').setDisabled(false);
  268. Ext.getCmp('history').setDisabled(false);
  269. Ext.getCmp('downloaderror').hide();
  270. field.ownerCt.ownerCt.ownerCt.hide();
  271. },
  272. failure: function(fp, o){
  273. if(o.result.size){
  274. showError(o.result.error + "&nbsp;" + Ext.util.Format.fileSize(o.result.size));
  275. field.reset();
  276. } else {
  277. showError(o.result.error);
  278. field.reset();
  279. }
  280. }
  281. });
  282. }
  283. },
  284. emptyData: function(arr){
  285. var fields = new Array();
  286. Ext.each(arr, function(a){
  287. fields.push(a.field_);
  288. });
  289. return new Ext.data.Store({
  290. fields: fields,
  291. data: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]
  292. });
  293. },
  294. parseUpdateDetails: function(arr){
  295. var me = this, d = new Array(),o;
  296. d.push({xtype: 'rownumberer', width: 35});
  297. Ext.each(arr, function(a){
  298. o = new Object();
  299. o.text = a.caption_;
  300. o.dataIndex = a.field_;
  301. o.width = a.width_;
  302. o.dataType = a.type_;
  303. o.editor = {
  304. xtype: 'textfield'
  305. };
  306. o.renderer = function(val, meta, record, x, y, store, view){
  307. return val;
  308. };
  309. d.push(o);
  310. });
  311. return d;
  312. },
  313. loadUpdateData: function(grid, page){
  314. var f = (page-1) * 100 + 1,
  315. t = page*100;
  316. grid.setLoading(true);
  317. Ext.Ajax.request({
  318. url: basePath + 'ma/update/getUpdateData.action',
  319. params: {
  320. condition: "ud_ulid=" + grid.ulid +
  321. " AND ud_detno between " + f + " AND " + t
  322. },
  323. method: 'post',
  324. callback: function(options, success, response){
  325. var res = new Ext.decode(response.responseText);
  326. grid.setLoading(false);
  327. if(res.exceptionInfo != null){
  328. showError(res.exceptionInfo);return;
  329. } else {
  330. var datas = new Array(), o;
  331. Ext.each(res.data, function(d){
  332. o = Ext.decode(d.ud_data);
  333. o.ud_id = d.ud_id;
  334. datas.push(o);
  335. });
  336. grid.store.loadData(datas);
  337. }
  338. }
  339. });
  340. },
  341. createGrid: function(p, id,title, isReload) {
  342. var me=this;
  343. var store = me.emptyData(schemeDetails);
  344. var updategrid= Ext.create('Ext.grid.Panel', {
  345. anchor: '100% 100%',
  346. id : 'updategrid-data',
  347. cls : 'default-grid',
  348. cfg: schemeDetails,//当前导入项的配置信息
  349. ulid:-1,
  350. checked:0,
  351. columnLines: true,
  352. columns: me.parseUpdateDetails(schemeDetails),
  353. store: store,
  354. dockedItems: [me.getDockedItems(store)],
  355. getGridData: function(page){
  356. me.loadUpdateData(this, page);
  357. },
  358. loadData: function(ulid, count, page){
  359. this.ulid = ulid;
  360. this.down('pagingtoolbar').dataCount = count;
  361. this.down('pagingtoolbar').onLoad();
  362. this.getGridData(page);
  363. }
  364. });
  365. p.add(updategrid);
  366. },
  367. loadDefaultData: function(grid, page,ulid){
  368. var f = (page-1) * 100 + 1,
  369. t = page*100;
  370. grid.setLoading(true);
  371. Ext.Ajax.request({
  372. url: basePath + 'ma/update/getUpdateData.action',
  373. params: {
  374. condition: "ud_ulid =" + grid.ulid +
  375. "AND UD_CHECKED=0 AND ud_detno between " + f + " AND " + t
  376. },
  377. method: 'post',
  378. callback: function(options, success, response){
  379. var res = new Ext.decode(response.responseText);
  380. grid.setLoading(false);
  381. if(res.exceptionInfo != null){
  382. showError(res.exceptionInfo);return;
  383. } else {
  384. var datas = new Array(), o;
  385. Ext.each(res.data, function(d){
  386. o = Ext.decode(d.ud_data);
  387. o.ud_id = d.ud_id;
  388. datas.push(o);
  389. });
  390. grid.store.loadData(datas);
  391. }
  392. }
  393. });
  394. },
  395. checkData:function(){
  396. var me=this,grid=Ext.getCmp('updategrid-data');
  397. grid.setLoading(true);
  398. Ext.Ajax.request({
  399. url: basePath + 'ma/update/checkData.action',
  400. params: {
  401. ulid:grid.ulid
  402. },
  403. method: 'post',
  404. callback: function(options, success, response){
  405. var res = new Ext.decode(response.responseText);
  406. grid.setLoading(false);
  407. if(res.exceptionInfo != null){
  408. /*console.log(Ext.getCmp('checkupdate').activeItem.itemIndex);
  409. Ext.getCmp('checkupdate').activeItem.itemIndex=1;*/
  410. Ext.getCmp('downloaderror').show();
  411. me.loadDefaultData(grid,1);
  412. showError(res.exceptionInfo);return;
  413. } else {
  414. grid.checked=1;
  415. Ext.getCmp('downloaderror').hide();
  416. alert('校验成功!');
  417. }
  418. }
  419. });
  420. },
  421. updateData: function(){
  422. var me=this,grid=Ext.getCmp('updategrid-data');
  423. if(grid.checked==1){
  424. grid.setLoading(true);
  425. Ext.Ajax.request({
  426. url: basePath + 'ma/update/updateData.action',
  427. params: {
  428. ulid:grid.ulid
  429. },
  430. method: 'post',
  431. callback: function(options, success, response){
  432. var res = new Ext.decode(response.responseText);
  433. grid.setLoading(false);
  434. if(res.exceptionInfo != null){
  435. showError(res.exceptionInfo);return;
  436. } else {
  437. alert('更新成功!');
  438. }
  439. }
  440. });}
  441. else showError('请先校验数据!');
  442. },
  443. history:function(){
  444. var w = Ext.create('Ext.Window', {
  445. width: '60%',
  446. height: '80%',
  447. id: 'history-win',
  448. title: '更新数据历史记录',
  449. autoShow: true,
  450. layout: 'anchor',
  451. items: [{
  452. xtype: 'gridpanel',
  453. anchor: '100% 100%',
  454. columnLines: true,
  455. columns: [{dataIndex: 'ul_id', hidden: true},{dataIndex: 'ul_usid', hidden: true},{dataIndex: 'ul_man', text: '更新人编号', flex: 1},
  456. {dataIndex: 'ul_date', text: '日期', flex: 2},
  457. {dataIndex: 'ul_count', text: '数据量(条)', flex: 1},
  458. {dataIndex: 'ul_checked', text: '是否校验通过', flex: 1, renderer: function(val, m){
  459. if(val == '否') {
  460. m.style = 'float:right';
  461. }
  462. return val;
  463. }}, {dataIndex: 'ul_success', text: '是否更新成功', flex: 1, renderer: function(val, m){
  464. if(val == '否') {
  465. m.style = 'float:right';
  466. }
  467. return val;
  468. }}, {text: '', flex: 1, renderer: function(val, m, r){
  469. return '<a href="javascript:Ext.getCmp(\'updategrid\').addGrid();Ext.getCmp(\'updategrid-data\').loadData(' + r.get('ul_id') + ','
  470. + r.get('ul_count') + ',1);Ext.getCmp(\'history-win\').close();Ext.getCmp(\'scheme-win\').close();Ext.getCmp(\'checkupdate\').setDisabled(true);Ext.getCmp(\'history\').setDisabled(false);">载入</a>';
  471. }}],
  472. store: Ext.create('Ext.data.Store', {
  473. fields: ['ul_id', 'ul_usid', 'ul_man', 'ul_date', 'ul_count', 'ul_checked', 'ul_success'],
  474. data: [{},{},{},{},{},{},{},{}]
  475. })
  476. }]
  477. });
  478. this.getUpdateLog(w.down('gridpanel'));
  479. },
  480. getUpdateLog: function(g){
  481. Ext.Ajax.request({
  482. url: basePath + 'ma/update/updateHistory.action',
  483. params: {
  484. id: Ext.getCmp('scheme_id_').value
  485. },
  486. method: 'post',
  487. callback: function(opt, s, r){
  488. var res = new Ext.decode(r.responseText);
  489. var dd = res.data;
  490. Ext.each(dd, function(d){
  491. d.ul_date = Ext.Date.format(new Date(d.ul_date), 'Y-m-d H:i:s');
  492. d.ul_checked = d.ul_checked == 1 ? '是' : '否';
  493. d.ul_success = d.ul_success == 1 ? '是' : '否';
  494. });
  495. g.store.loadData(dd);
  496. }
  497. });
  498. },
  499. getDockedItems: function(store){
  500. return {
  501. xtype: 'pagingtoolbar',
  502. store: store,
  503. pageSize: 100,
  504. dataCount: store.data.items.length,
  505. page: 1,
  506. dock: 'bottom',
  507. displayInfo: true,
  508. updateInfo : function(){
  509. var page = this.child('#inputItem').getValue() || 1;
  510. var me = this,
  511. pageSize = me.pageSize || 100,
  512. dataCount = me.dataCount || 20;
  513. var displayItem = me.child('#displayItem'),
  514. pageData = me.getPageData();
  515. pageData.fromRecord = (page-1)*pageSize+1;
  516. pageData.toRecord = page*pageSize > dataCount ? dataCount : page*pageSize;
  517. pageData.total = dataCount;
  518. var msg;
  519. if (displayItem) {
  520. if (me.dataCount === 0) {
  521. msg = me.emptyMsg;
  522. } else {
  523. msg = Ext.String.format(
  524. me.displayMsg,
  525. pageData.fromRecord,
  526. pageData.toRecord,
  527. pageData.total
  528. );
  529. }
  530. displayItem.setText(msg);
  531. me.doComponentLayout();
  532. }
  533. },
  534. getPageData : function(){
  535. var me = this,
  536. totalCount = me.dataCount;
  537. return {
  538. total : totalCount,
  539. currentPage : me.page,
  540. pageCount: Math.ceil(me.dataCount / me.pageSize),
  541. fromRecord: ((me.page - 1) * me.pageSize) + 1,
  542. toRecord: Math.min(me.page * me.pageSize, totalCount)
  543. };
  544. },
  545. doRefresh:function(){
  546. this.moveFirst();
  547. },
  548. onPagingKeyDown : function(field, e){
  549. var me = this,
  550. k = e.getKey(),
  551. pageData = me.getPageData(),
  552. increment = e.shiftKey ? 10 : 1,
  553. pageNum = 0;
  554. if (k == e.RETURN) {
  555. e.stopEvent();
  556. pageNum = me.readPageFromInput(pageData);
  557. if (pageNum !== false) {
  558. pageNum = Math.min(Math.max(1, pageNum), pageData.pageCount);
  559. me.child('#inputItem').setValue(pageNum);
  560. if(me.fireEvent('beforechange', me, pageNum) !== false){
  561. me.page = pageNum;
  562. me.ownerCt.getGridData(me.page);
  563. }
  564. }
  565. } else if (k == e.HOME || k == e.END) {
  566. e.stopEvent();
  567. pageNum = k == e.HOME ? 1 : pageData.pageCount;
  568. field.setValue(pageNum);
  569. } else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN) {
  570. e.stopEvent();
  571. pageNum = me.readPageFromInput(pageData);
  572. if (pageNum) {
  573. if (k == e.DOWN || k == e.PAGEDOWN) {
  574. increment *= -1;
  575. }
  576. pageNum += increment;
  577. if (pageNum >= 1 && pageNum <= pageData.pages) {
  578. field.setValue(pageNum);
  579. }
  580. }
  581. }
  582. me.updateInfo();
  583. me.resetTool(value);
  584. },
  585. moveFirst : function(){
  586. var me = this;
  587. me.child('#inputItem').setValue(1);
  588. value = 1;
  589. me.page = value;
  590. me.ownerCt.getGridData(value);
  591. me.updateInfo();
  592. me.resetTool(value);
  593. },
  594. movePrevious : function(){
  595. var me = this;
  596. me.child('#inputItem').setValue(me.child('#inputItem').getValue() - 1);
  597. value = me.child('#inputItem').getValue();
  598. me.page = value;
  599. me.ownerCt.getGridData(value);
  600. me.updateInfo();
  601. me.resetTool(value);
  602. },
  603. moveNext : function(){
  604. var me = this,
  605. last = me.getPageData().pageCount;
  606. total = last;
  607. me.child('#inputItem').setValue(me.child('#inputItem').getValue() + 1);
  608. value = me.child('#inputItem').getValue();
  609. me.page = value;
  610. me.ownerCt.getGridData(value);
  611. me.updateInfo();
  612. me.resetTool(value);
  613. },
  614. moveLast : function(){
  615. var me = this,
  616. last = me.getPageData().pageCount;
  617. total = last;
  618. me.child('#inputItem').setValue(last);
  619. value = me.child('#inputItem').getValue();
  620. me.page = value;
  621. me.ownerCt.getGridData(value);
  622. me.updateInfo();
  623. me.resetTool(value);
  624. },
  625. onLoad : function() {
  626. var e = this, d, b, c, a;
  627. if (!e.rendered) {
  628. return ;
  629. }
  630. d = e.getPageData();
  631. b = d.currentPage;
  632. c = Math.ceil(e.dataCount / e.pageSize);
  633. a = Ext.String.format(e.afterPageText, isNaN(c) ? 1 : c);
  634. e.child("#afterTextItem").setText(a);
  635. e.child("#inputItem").setValue(b);
  636. e.child("#first").setDisabled(b === 1);
  637. e.child("#prev").setDisabled(b === 1);
  638. e.child("#next").setDisabled(b === c || c===1);//
  639. e.child("#last").setDisabled(b === c || c===1);
  640. e.child("#refresh").enable();
  641. e.updateInfo();
  642. e.fireEvent("change", e, d);
  643. },
  644. resetTool: function(value){
  645. var pageCount = this.getPageData().pageCount;
  646. this.child('#last').setDisabled(value == pageCount || pageCount == 1);
  647. this.child('#next').setDisabled(value == pageCount || pageCount == 1);
  648. this.child('#first').setDisabled(value <= 1);
  649. this.child('#prev').setDisabled(value <= 1);
  650. }
  651. };
  652. }
  653. });