zoukankan      html  css  js  c++  java
  • ExtJS pagingtoolbar的使用

    view层:

      this.bbar = [{
             	 xtype: 'pagingtoolbar',
             	 //增加id
             	 id : 'ptb',
                 pageSize: 2,
                 store: this.store,
                 displayInfo: true,
                 plugins: new Ext.ux.ProgressBarPager()
             }];
    

    store层

     1 Ext.define('Industry_Demo.store.Industry', {
     2      extend: 'Ext.data.Store',
     3      /*
     4      fields: [{name: 'PK_Industry_ID',type: 'int'},
     5              {name: 'Industry_Name',type : 'string'}
     6              ],
     7              */
     8      model : 'Industry_Demo.model.Industry',
     9      pageSize : 2,
    10      //非常重要的属性
    11      //autoLoad: {start : 0, limit : 2},
    12      proxy: {
    13           type : 'ajax',
    14           enablePaging: true,
    15          // url : 'data/industries.json',
    16           url : '/IndustryAdmin/getIndustries.do',
    17           reader: {
    18              type : 'json',
    19              root : 'industries',
    20              successProperty: 'success',
    21              totalProperty : 'total'
    22             
    23         }
    24      }
    25      /*
    26      data  : [
    27                  {PK_Industry_ID:1,Industry_Name:'aa'},
    28                  {PK_Industry_ID:2,Industry_Name:'bb'}
    29              ]
    30          */    
    31  });

    controller层

    Ext.define('Industry_Demo.controller.Industry',{
         //必须和文件同名
          extend : 'Ext.app.Controller',
          init : function() {
              // console.log("Hello");
               this.control({
                   
                    'industryList' : {
                        itemdblclick: this.editRecord,
                        render : function(myView){
                            myView.getStore().load({params:{start:0,limit:2}});
                        }
                    },

    后台代码springmvc+mybatis

    @RequestMapping(value="/getIndustries",method=RequestMethod.GET)
        public void getIndustries(HttpServletRequest request,HttpServletResponse response){
            String startString = request.getParameter("start");
            String limitString = request.getParameter("limit");
            int start = Integer.valueOf(startString);
            int limit = Integer.valueOf(limitString);
            System.out.println("select controller层");
            System.out.println(start+" "+limit);
            int num = industryService.getIndustriesNum();
            System.out.println(num+" ");
            List<Industry> list = null;
            list =  industryService.getIndustries(start, limit);
            System.out.println("mission completed I am back");
        
            String jsonString = "{success : true,total : ";
            jsonString +=num;
            jsonString +=",industries : [";
            int i = 0;
            if(list.size()>0){
            for(;i <list.size()-1;i++){
                jsonString += "{id : "+ list.get(i).getId() + ",name : '"+list.get(i).getName()+"'},";
            }
            jsonString +="{id :" + list.get(i).getId()+",name : '"+list.get(i).getName()+"'}]}";
            }
            else{
                jsonString = "{success : true,total : ";
                jsonString +=num;
                //jsonString +=",industries ";
                //jsonString +="{}]}";
                 jsonString += "}";
            }
            try {
                response.getWriter().write(jsonString);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                System.out.println("Something not good happen");
                e.printStackTrace();
            }
            
        }
  • 相关阅读:
    Azure 虚拟机安全加固整理
    AzureARM 使用 powershell 扩容系统磁盘大小
    Azure Linux 云主机使用Root超级用户登录
    Open edX 配置 O365 SMTP
    powershell 根据错误GUID查寻错误详情
    azure 创建redhat镜像帮助
    Azure Powershell blob中指定的vhd创建虚拟机
    Azure Powershell 获取可用镜像 PublisherName,Offer,Skus,Version
    Power BI 连接到 Azure 账单,自动生成报表,可刷新
    Azure powershell 获取 vmSize 可用列表的命令
  • 原文地址:https://www.cnblogs.com/hzmbbbb/p/3936531.html
Copyright © 2011-2022 走看看