简体   繁体   中英

Extjs Paging with additional Parameter

I'am working on a ExtJS 4.2 Project, where i want to use a Paging Toolbar to navigate through Images. When i open the Window, all Images are correct, but when i click on the next button to see the next Images, the result is empty. Its because the Parameter Id isn't passed to the backend System. I saw in other Threads an option like baseParams but they are not in the documentation and don't work.

//My Store Class
Ext.define('App.store.Images', {
  extend: 'Ext.data.Store',
  model: 'App.model.Images',
  autoLoad: false,
  autoSync: false,
  storeId: 'Images',
  pageSize: 8,
  proxy: {
    type: 'ajax',
    url: '/getImages',
    reader: {
        type: 'json',
        root: 'images',
        totalProperty: 'total'
    }
  }
});
// This code is execute when i open the Window
var imagesStore = Ext.StoreManager.get('Images');
imagesStore.on('load', buildContent);
imagesStore.load({
    params: {
        id: record.get('id'),
        start: 0,
        limit: 8
    }
});

Where can be additional Parameter be defined?

In fact you can define extraParams on the store proxy. You can do this just before the load method call :

Ext.apply(store.getProxy().extraParams, {
    'yourId': yourId
});

or in your proxy config :

proxy: {
    type: 'ajax',
    url: '/getImages',
    reader: {
        type: 'json',
        root: 'images',
        totalProperty: 'total'
    }
    extraParams: {
        'yourId': yourId
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM