• PagingToolbar 设置每页条数


    Ext.PagingToolbar默认没办法设置每页条数。

    如图:

    image

    如果想让用户自己定义每页条数:

    如图:

    image

    网上找了半天竟然找不到相应的解决办法,只能自己去写个控件。

    代码:

    /*!
    * HlJS Library 1.0.0
    * Copyright(c) 2006-2010 HZZY, LLC
    * lighthong@sina.com.cn
    * http:
    */
    /**
    * @class Hljs.component.HlPagingToolbar
    * 在Ext.PagingToolbar的基础上增加了自己设置每页多少条的功能
    * 20100717 创建
    */
    Ext.namespace("Hljs.component");

    Hljs.component.HlPagingToolbar = Ext.extend(Ext.PagingToolbar, {
        displayInfo: true,
        displayMsg: '显示第 {0} 条到 {1} 条记录,共 {2} 条',
        emptyMsg: "无记录",
        initComponent : function(){
            var pageSizeItems = [
                         '每页',
                         this.inputItem = new Ext.form.NumberField({
        cls: 'x-tbar-page-number',
        allowDecimals: false,
        allowNegative: false,
        enableKeyEvents: true,
        maxValue: 500,
        maxText: '每页不允许超过500条',
        selectOnFocus: true,
        value: this.pageSize,
        submitValue: false,
        listeners: {
            scope: this,
            keydown: this.onHlPagingKeyDown,
            blur: this.onHlPagingBlur
        }
                         }),'条'
                         ];
             var userItems = this.items || [];
             this.items = userItems.concat(pageSizeItems);
             Hljs.component.HlPagingToolbar.superclass.initComponent.call(this);
        },
        onHlPagingKeyDown: function(field, e){
            if(field.isValid()){
                var k = e.getKey();
                 if (k == e.RETURN) {
                        e.stopEvent();
                        this.pageSize = field.getValue();
                        this.doRefresh();
                 }
            }
        },
        onHlPagingBlur: function(field){
            if(field.isValid()){
                this.pageSize = field.getValue();
                this.doRefresh();
            }
        }
    });

  • 相关阅读:
    struts2 标签给iterator添加自然序号
    theirtts2
    zhihutheirTTS1
    theirs《A 2019 Guide to Speech Synthesis with Deep Learning》
    theirmvsnetv00000
    theirmvsnetv2
    theirMeshCNN/
    their MVF-Net: Multi-View 3D Face Morphable Model Regression(2019 CVPR)
    their DenseFusion6dof
    C++35
  • 原文地址:https://www.cnblogs.com/barryhong/p/1779742.html
Copyright © 2020-2023  润新知