You can use the addFilter() or setFilters() on the store to add other parameters to be passed doing the load.
If you are just trying to get a single record (instance of a model) From what I understand there are two ways to do this.
One way is to create an instance of the model and execute the load method. You can pass in params. I am using the Ext.Direct (json RPC like framework) store. Not sure if this has anything to do with the params etc.
When you define the model you define the api in the proxy that you are using so it knows what methods to call for loading, saving and deleting records.
Code:
// this goes in the Model class.
proxy: {
type: 'direct',
// This is for the read method extraParams are not
// sent in any of the other methods as per the Ext.Direct Proxy.
extraParams: {
entityName: '{entityName}'
},
api: {
prefix: 'GenericDirect',
create: 'create',
read: 'read',
update: 'update',
destroy: 'destroy'
},
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'total',
messageProperty: 'message'
},
// This is used by all methods other than read.
metadata: {
entityName: '{entityName}'
}
}
Code:
let header = new Dcs.model.InvoiceHeader();
header.load({
params: {
id: {
divisionCode: divcode,
invoiceCode: invcode
}
},
failure: function(record, operation) {
console.log("failed to load invoice");
},
success: function(record, operation) {
viewModel.set('invoiceHeaderRecord', header);
console.log('loaded invoice');
},
callback: function(record, operatioin, success) {
console.log("nvoice callback");
}
});
The other way is by sending the primary key or the idProperty field as the first
argument in the static load method of the model class.
Code:
let header = Dcs.model.InvoiceHeader.load(divcode+":"+invcode, {
failure: function(record, operation) {
console.log("failed to load invoice");
},
success: function(record, operation) {
viewModel.set('invoiceHeaderRecord', header);
console.log('loaded invoice');
},
callback: function(record, operatioin, success) {
console.log("nvoice callback");
}
});