Ext grid list shows the number of control lines (grid toolbar to add a drop-down list)

sponsored links
I am very excited and relieved to have their own experience to share Ext done to everyone!
I remember once met such a very painful problem!
Is Ext's grid table shows the number of rows to the grid in good control of the original to add a tool bar
      /**
      *@see  The paging toolbar  
      */
          var bbar = new Ext.PagingToolbar({
          pageSize : number,
          store : store,
          displayInfo : true,
          displayMsg : ' Display the second   {0}  Bar to the   {1}  Records, a total of   {2}  Bar  ',
          emptyMsg : " No records  "
                });
   


pageSize: number, the pageSize property has not thought out approach to how to make him dynamic!
Initialization of the display results page article a few are OK, the implementation of the first query shows the number of articles also correct, but changed the number of articles displayed toolbar with the toolbar click Next when the page is initialized according to the display of the number of articles to flip!
Later on the website to ask a number of shrimp, well, have presented a solution!
I am here, then order and sort out!

The following code:
/**
     *@see  The paging toolbar, select the drop-down list  
     */
  var pagesize_combo = new Ext.form.ComboBox({
      store: [['5', 5], ['10', 10], ['20', 20], ['50', 50], ['100', 100]],
      width:50,   
      readOnly:true,   
      emptyText: '20',   
      mode: 'remote',   
      triggerAction: 'all',   
      valueField: 'value',   
      displayField: 'text'  
     });         
      
      /**
      *@see  The number of select drop-down list-select event  
      */
      pagesize_combo.on("select",function(comboBox){          
      bbar.pageSize = parseInt(comboBox.getValue());   
      number=parseInt(comboBox.getValue());
      //store.reload({params:{start:0,limit:page_toolbar.pageSize}});   
       });     
      
      /**
      *@see  The paging toolbar  
      */
          var bbar = new Ext.PagingToolbar({
          pageSize : number,
          store : store,
          displayInfo : true,
          displayMsg : ' Display the second   {0}  Bar to the   {1}  Records, a total of   {2}  Bar  ',
          emptyMsg : " No records  ",
          items:[ '   Page number  :', pagesize_combo] 
                });
      
      /**
      *@see  A form template  
      */
      var grid=new Ext.grid.GridPanel({                                                                                                                         //GridPanel Inherits from the Panel class  
      stripeRows:true,
      loadMask:true,
      store:store,                                                                                                                                                                                      //store  On behalf of the above   store  Object   
      cm:grid_colum,                                                                                                                                                                            //gird_colum  An object representing the above grid_colum   
      sm:sm,
      viewConfig:{
      forceFit:true
      },
      bbar:bbar                                 
      });
   


In the grid toolbar add a drop-down list pagesize_combo, and added a select to pagesize_combo selected events, in the event function bbar.pageSize = parseInt (comboBox.getValue ()); to change the pageSize value, Ha ha in the know Following this approach, I suddenly realized, in fact, can not use a drop-down list, but do so, it is really nice!

Figure:

Ext grid list shows the number of control lines (grid toolbar to add a drop-down list)
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Ext grid list shows the number of control lines (grid toolbar to add a drop-down list)

  • hibernate load delay

    Lazy loading: Lazy loading mechanism is in order to avoid unnecessary performance overhead and put forward the so-called lazy loading is required when the real data at a time when the real implementation of the data load operation. At Hibernate provides f

  • Hibernate II Study Notes

    11. Many-to-many Of many that can be converted to two one-to-many <set name="students" table="teacher_student"> <key column="techer_id"/> <many-to-many column="student_id"/> </set> many-to-many data only from one end of the mainten

  • js page Jump implementation of a number of ways

    The first is: <script language="javascript" type="text/javascript"> window.location.href = "login.jsp? backurl =" + window.location.href; </ script> The second: <script language="javascript"> alert

  • Dynamic loading JS script four kinds of methods

    To achieve dynamic loading JS script has four kinds of methods: 1, direct document.write <script language="javascript"> document.write ( "<script src='test.js'> <\ / script>"); </ script> 2, dynamic scri

  • Hibernate primary key strategy-sequence

    Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...

  • Hibernate pessimistic locking mechanism for locking and optimistic locking

    hibernate lock mechanism 1. Pessimistic lock It refers to the modification of data by outsiders hold a conservative attitude. The assumption that at any time access to data, may also have another client to access the same data, in order to maintain t ...

  • Nan-Jing 5: When IBatis.Hibernate mixed affairs, pay attention to your SQL

    [Problem] Now, in the development of the so-called multi-storey JavaEE applications, data persistence layer is always essential, and "Automatic" of ORM - Hibernate, and "all-manual-type" of SqlMap - IBatis, equivalent data are Per ...

  • hibernate to use the principle of

    The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...

  • Based on JDBC, JPA Annotation achieve simple CRUD Generic Dao

    The origin of ideas are pretty long history of reasons: [Use iBATIS history] The use of iBATIS has been a long time, the system is to use the CRUD template tool to generate the code, although there are tools to generate, but looked at a lot of CRUD the Sq

  • Hibernate's lazy strategy

    hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries