Extjs_09 _ custom paging component and extjs_09 paging component
1. Project
2. CustomSizePagingToolbar. js
Ext. define ("Ext. ux. customSizePagingToolbar ", {// The name must be the same as the file name. extend:" Ext. toolbar. paging ", alias:" widget. custompaging ", // alias beforSizeText:" per page ", afterSizeText:" bar ", getCustomItems: function () {var me = this; // custom customComStorevar customComStore = Ext. create ("Ext. data. jsonStore ", {fields: [" customPageSize "], data: [{customPageSize:" 10 "},{ customPageSize:" 20 "},{ customPageSize:" 50 "}, {customPageSize: "100"}]}) // customize customComboBoxvar customComboBox = Ext. create ("Ext. form. field. comboBox ", {itemId:" customComboId ", store: customComStore, queryMode:" local ", displayField:" customPageSize ", valueField:" customPageSize ", enableKeyEvents: true, // sensor keyboard event width: 60, listeners: {scope: me, // scope select: me. onCustomSelect, keydown: me. onCustomKeyDown, blur: me. onCustomBlur }}); //-indicates the split line.> indicates return ["-", me. beforSizeText, customComboBox, me. afterSizeText];}, onCustomSelect: function (combo, records, eOpts) {// select an event to trigger var me = this; me. store. pageSize = records [0]. data. customPageSize; me. store. loadPage (1); // load the first page by default}, onCustomKeyDown: function (field, e, eOpts) {// trigger var me = this by pressing a key event; var k = e. getKey (); if (k = e. ENTER) {e. stopEvent (); // stop other event me. store. pageSize = me. child ("# customComboId "). getValue (); me. store. loadPage (1) ;}}, onCustomBlur: function (combo, the, eOpts) {// var me = this; me. child ("# customComboId "). setValue (me. store. pageSize) ;}, // initialize the interface component initComponent: function () {var me = this; Ext. apply (me, {// application, additional items: me. getCustomItems ()}); me. callParent (arguments); me. child ("# customComboId "). setValue (me. store. pageSize); // initialization value }})
3. custompaging. jsp
<% @ Page language = "java" import = "java. util. *" pageEncoding = "UTF-8" %> <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
Extjs41 the custom parameters of gridpanel paging query cannot be passed to the background. How can I set them ,! Thank you very much.
Ext. create ('ext. data. store', {fields: ['1', '2', '3'], pageSize: 16, proxy: {type: 'ajax ', url: 'xxx ', extraParams: {// method 1. add an additional parameter here. In this case, if the parameter is too much during actual measurement, it will be invalid type: type}, reader: {type: 'json ', root: 'xxx', totalProperty: 'xxx'}, listeners: {beforeload: function (s) {// method 2, add listening event Ext. apply (s. proxy. extraParams, {type: type });}}});
How to add an event when customizing the paging control in aspnet
When designing a custom page control, define an event triggered when the page number changes in the page control class. In the class, determine whether the event is registered externally. If the event has been registered, the event processing is handed over to the event registrant.
Public event EventHandler <PagerEventArgs> OnPagerChanged;
// Judge
If (OnPagerChanged! = Null)
{
OnPagerChanged (this, new PagerEventArg {CurrentPageIndex = 0 });
}
Public class PagerEventArgs: EventArgs
{
Public Int32 CurrentPageIndex {get; set ;}
}
// Register the PagerChanged event on the page using the custom paging Control
MyPager1.OnPagerChanged + = new EventHandler <PagerEventArgs> (MyPager1_PagerChanged );
// Callback
Protected void MyPager1_PagerChanged (Object sender, PagerEventArgs e)
{
// Rebind data
}
Note: In some cases, this may be the case.