Summary of specific problems encountered during the development of EXTJSMVC

Source: Internet
Author: User

1. Landing related issues

1. How to add a hint to a text box
2. How to trigger a carriage return event in a text box
3. How to trigger the action of a button in a carriage return event
Summary: http://www.cnblogs.com/sdjnzqr/p/3922726.html

2. Read-only text box style settings

Reference article: Http://stackoverflow.com/questions/9214297/how-do-i-change-color-of-a-textfield-using-extjs

3. Questions about the return of query data

In a real business system, most of the data returned cannot be returned to the corresponding entity in the database, which is generally a mixed attribute between several entities, which results in the need to create a large number of model when using the MVC schema, resulting in the complexity of the code, so it is recommended to use as few model as possible, Use JSON whenever possible.

How 4.Ajax is called

http://blog.csdn.net/hrl_100/article/details/5639922
5. Use of global variables
Reference: http://phpcode8.com/web/extjs/extjs-global-variable.html
JSON format returned on 6.form commit

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 error when returning Chinese string
  
   The first of these solutions:
@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

Attention:

I am using the spring package of 3.1.2, which cannot be resolved by configuration XML in version 3.1.2, only by modifying the source code or inheriting the class.

In addition: Each version of the Stringhttpmessageconverter implementation in a different way, pay attention to the implementation.

7. Tree-related issues
  Reference article:
     Http://www.cnblogs.com/mrye/archive/2013/05/26/3100431.html
     http://ishowshao.com/blog/2012/08/17/extjs-4-trees/
Precautions:
   1. The source of the number depends on the Ext.data.TreeStore, so be sure to set this data source.
   2. When defining a tree node attribute, it is necessary to define the id,text,leaf, if you want to use other fields instead, such as using name as the real content of the tree node, it needs to be defined by column.
Understanding of the properties of refs in 8.Controller
Reference article:
    Http://www.cnblogs.com/liuqxFuture/archive/2012/11/10/2763764.html
    http://czpae86.iteye.com/blog/1181110
9. The issue of dynamic load Controller * * * * focus
Reference article: http://www.cnblogs.com/servant/archive/2013/04/01/ExtJs4mvc%E5%8A%A8%E6%80%81%E5%8A%A0%E8%BD%BDController.html
Precautions:
   In the original text:
    var Bhcmscontroller = Application.getcontroller (' Bhcmscontroller ');        Bhcmscontroller.init (self);
will cause problems in the Init method to execute twice, the correct one should be:
if(! Ext.ClassManager.isCreated (' MyExt.controller.qxgl.UserController ') {//To determine if the controller has been loaded; Ext.require ("MyExt.controller.qxgl.UserController",function () {                                varUsercontroller = 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 '); }
Problems with the 10.Form layout definition
Reference article: http://z-xiaofei168.iteye.com/blog/1136291
11. Turn off the error on the tab page
Error Description: Error:cannot Read property ' addcls ' of NULL
Reason: http://blog.csdn.net/lc448986375/article/details/8019649
12. How to refresh the grid problem
http://blog.csdn.net/lc448986375/article/details/8019649
Problems with 13.grid Date column display
Use the Renderer property to turn the digital time passed in from the background into a time that ExtJS can accept.
            Text: ' Login time ',                ' Lastlogin ',                function(value) {                    return Ext.util.Format.date (new date (1404098883000), ' y-m-d ');                }

14.DataGird Paging Implementation

Reference article: http://www.vipaq.com/Article/View/blog/239.html

Three parameters required for a background implementation: Page,start,limit

Code implementation:

varstore = 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 pageproxy: {type:' Ajax ', URL:' Test/queryallusers.json ',//URL that would load data with respect to start and limit paramsreader: {type:' JSON ', Root:' Rows ', Totalproperty:' Total '                }            }        });
Ext.create (' Ext.grid.Panel ', {title:' Query Results ', Region:' Center ', margin:' 5 0 0 0 ', Store:store, columns: [{text:' User ID ', Dataindex:' ID '}, {text:' User code ', Dataindex:' Usercode ', Flex:1}, {text:' Login status ', Dataindex:' Loginstate '}, {text:' Login Time ', Dataindex:' Lastlogin ', renderer:function(value) {returnExt.util.Format.date (NewDate (1404098883000), ' y-m-d '); }}], Dockeditems: [{xtype:' Pagingtoolbar ', Store:store,//Same Store Gridpanel is usingDock: ' Bottom ', DisplayInfo:true                }],        })
With parameter query
Store.on ("beforeload",function() {                ext.apply (store.proxy.extraParams, {userid:button.up (' Form '). (' textfield[name=id] '). GetValue (),                    usercode:button.up (' form '). Down (' Textfield[name= Usercode] '). GetValue ()});            /datagrid Query                        store.load ({                params:{                    start:0,                                    }            });

Summary of specific problems encountered during the development of EXTJSMVC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.