標籤:style blog http color os 使用 io strong for
1.登陸相關問題
1.如何在文字框中增加提示資訊
2.如何在文字框中觸發斷行符號事件
3.如何在斷行符號事件中觸發按鈕的動作
總結:http://www.cnblogs.com/sdjnzqr/p/3922726.html
2.唯讀文字框樣式設定
參考文章:http://stackoverflow.com/questions/9214297/how-do-i-change-color-of-a-textfield-using-extjs
3.關於查詢資料返回的問題
在真正的業務系統中,大部分資料返回時無法返回資料庫中對應的實體,一般來說都是幾個實體之間的混合屬性,這就造成了如果使用MVC架構時,需要在做查詢時,建立大量的Model,造成代碼的複雜度,因此建議盡量少用Model,有可能的話盡量使用json。
4.Ajax調用的方式
http://blog.csdn.net/hrl_100/article/details/5639922
5.全域變數的使用
參考:http://phpcode8.com/web/extjs/extjs-global-variable.html
6.form提交時返回的json格式
would process the following server response for a successful submission:
{ "success":true, // note this is Boolean, not string "msg":"Consignment updated" }
and the following server response for a failed submission:
{ "success":false, // note this is Boolean, not string "msg":"You do not have permission to perform this operation" }
7.SpringMVC返回中文String時出現中文亂碼
第一種解決方案:
@RequestMapping(value="/sys/functiontree",produces="text/plain;charset=UTF-8")
@ResponseBody public String getTreeData()
第二種解決方案:通過修改XMl設定檔或者而修改源碼來實現。
參考文章:
http://www.oschina.net/question/105887_114629?sort=time
http://blog.csdn.net/kissliux/article/details/14053761
注意:
我使用的是3.1.2的Spring包,在3.1.2版本中通過配置XML無法解決,只能通過修改源碼或者繼承類的方式實現。
另外:每個版本的StringHttpMessageConverter的實現方式不一樣,注意實現方式。
7.樹的相關問題
參考文章:
http://www.cnblogs.com/mrye/archive/2013/05/26/3100431.html
http://ishowshao.com/blog/2012/08/17/extjs-4-trees/
注意事項:
1.數的來源依賴於Ext.data.TreeStore,所以一定要定好這個資料來源。
2.定義樹節點屬性時,一定要的定義的是Id,text,leaf,如果要使用其他的欄位來代替,比如想通過name來作為樹節點的現實內容,則需要通過column來定義。
8.Controller中refs屬性的理解
參考文章:
http://www.cnblogs.com/liuqxFuture/archive/2012/11/10/2763764.html
http://czpae86.iteye.com/blog/1181110
9.動態載入controller的問題****重點
參考文章:http://www.cnblogs.com/servant/archive/2013/04/01/ExtJs4mvc%E5%8A%A8%E6%80%81%E5%8A%A0%E8%BD%BDController.html
注意事項:
原文中:
var bhcmsController = application.getController(‘BHCMSController‘); bhcmsController.init(self);
會造成在init方法執行兩次會有問題,正確的應該是:
if(!Ext.ClassManager.isCreated(‘MyExt.controller.qxgl.UserController‘)){//判斷controller是否已經載入; Ext.require("MyExt.controller.qxgl.UserController", function () { var userController = app.getController(‘qxgl.UserController‘); app.getController(‘FirstPageController‘).addTab(record.get(‘id‘),record.get(‘text‘),‘qxgl_userlist‘,‘true‘); }, self); }else{ app.getController(‘FirstPageController‘).addTab(record.get(‘id‘),record.get(‘text‘),‘qxgl_userlist‘,‘true‘); }
10.Form布局定義的問題
參考文章:http://z-xiaofei168.iteye.com/blog/1136291
11.關閉tab頁報錯的問題
錯誤描述:Error: Cannot read property ‘addCls‘ of null
原因:http://blog.csdn.net/lc448986375/article/details/8019649
12.如何重新整理grid的問題
http://blog.csdn.net/lc448986375/article/details/8019649
13.grid日期列顯示的問題
通過renderer屬性來將後台傳過來的數字時間變成Extjs能夠接受的時間
text : ‘登陸時間‘, dataIndex : ‘lastLogin‘, renderer: function(value){ return Ext.util.Format.date(new Date(1404098883000),‘Y-m-d‘); }
14.DataGird分頁的實現
參考文章:http://www.vipaq.com/Article/View/blog/239.html
後台實現時必須的三個參數:page,start,limit
代碼實現:
var store = Ext.create(‘Ext.data.Store‘, { id:‘simpsonsStore‘, autoLoad: false, fields:[ { name: ‘id‘, type: ‘string‘ }, { name: ‘userCode‘, type: ‘string‘ }, { name: ‘loginState‘, type: ‘string‘ }, { name: ‘lastLogin‘, type: ‘string‘ }, ], pageSize: 10, // items per page proxy: { type: ‘ajax‘, url: ‘test/queryAllUsers.json‘, // url that will load data with respect to start and limit params reader: { type: ‘json‘, root: ‘rows‘, totalProperty: ‘total‘ } } });
Ext.create(‘Ext.grid.Panel‘, { title : ‘查詢結果‘, region : ‘center‘, margin : ‘5 0 0 0‘, store: store, columns : [ { text : ‘使用者ID‘, dataIndex : ‘id‘ }, { text : ‘使用者編碼‘, dataIndex : ‘userCode‘, flex : 1 }, { text : ‘登陸狀態‘, dataIndex : ‘loginState‘ }, { text : ‘登陸時間‘, dataIndex : ‘lastLogin‘, renderer: function(value){ return Ext.util.Format.date(new Date(1404098883000),‘Y-m-d‘); } } ], dockedItems: [{ xtype: ‘pagingtoolbar‘, store: store, // same store GridPanel is using dock: ‘bottom‘, displayInfo: true }], })
//帶參數查詢
store.on("beforeload",function(){ Ext.apply(store.proxy.extraParams, {userid:button.up(‘form‘).down(‘textfield[name=id]‘).getValue(), usercode:button.up(‘form‘).down(‘textfield[name=usercode]‘).getValue()}); });//datagrid查詢 store.load({ params:{ start:0, limit: 10, } });
ExtjsMVC開發過程中遇到的具體問題總結