Load form from combo - combobox

I'm trying to load a form from a record selected in a combo.
The store is loaded properly and the combo is populated, but, when I select a value from combo, form fields remain empty.
Any help will be appreciated.
This is the code:
Model:
Ext.define('AA.model.proc.Process', {
extend: 'Ext.data.Model',
fields: [
{ name: 'name', type: 'string' },
{ name: 'owner', type: 'string' },
{ name: 'mail_dest', type: 'string' }
],
proxy: {
type: 'rest',
url : 'data/camp.json',
reader: {
type: 'json',
root: 'camp',
totalProperty: 'count'
}
}
});
Store:
Ext.define('AA.store.proc.Process', {
extend: 'Ext.data.Store',
model: 'AA.model.proc.Process',
requires: 'AA.model.proc.Process'
});
Class:
Ext.define('AA.view.proc.IM', {
extend: 'Ext.window.Window',
alias: 'widget.im',
title: 'IM',
layout: 'fit',
height: 500,
width: 400,
autoShow: true,
plain: true,
modal: true,
headerPosition: 'right',
closable: false,
initComponent: function () {
this.items = [{
xtype: 'form',
fileUpload: true,
width: 550,
autoHeight: true,
border: false,
bodyStyle: 'padding:5px 5px 0',
frame: true,
labelWidth: 100,
defaults: {
anchor: '95%',
allowBlank: false,
msgTarget: 'side'
},
items: [{
xtype: 'combo',
name: 'name',
store: 'procstore',
fieldLabel: 'Name',
valueField: 'name',
displayField: 'name',
width: 150,
allowBlank: true,
listeners: {
scope: this,
'select': this.loadForm
}
}, {
xtype: 'textfield',
fieldLabel: 'Name',
name: 'name'
}, {
xtype: 'textfield',
fieldLabel: 'Owner',
name: 'owner'
}, {
xtype: 'textfield',
fieldLabel: 'E-mail owner',
name: 'mail_dest'
}]
}];
this.buttons = [{
text: 'Save',
action: 'save'
}, {
text: 'Cancel',
scope: this,
handler: this.close
}];
this.callParent(arguments);
},
loadForm: function (field, record, option) {
console.log(record)
// firebug returns
// $className "AA.model.proc.Process"
// $alternateClassName "Ext.data.Record"
console.log(this.down('form'))
// firebug returns the right form panel
this.down('form').loadRecord(record);
}
});

This is from the documentation for the select event:
select( Ext.form.field.ComboBox combo, Array records, Object eOpts )
Notice that the second parameter is an Array. But in your example the second parameter is an Ext.data.Record. You are treating array as a record. Modify your loadForm to make it process arrays of records:
loadForm: function (field,records,option) {
this.down('form').loadRecord(records[0]);
}
P.S. By the way you have two fields with name: 'name'.

Related

How to configurate Ext.grid.plugin.Editable buttons?

I requires Ext.grid.plugin.Editable in my grid. Now I want to change classes inside default panel, witch slides right for editing of row.
But I don't understand how I to manage submit and delete button function (for example I want to define POST for submit button).
toolbarConfig - doesn't work
Ext.define('Foresto.model.EditListRenters', {
extend: 'Ext.grid.Grid',
xtype: 'rentlist',
requires: [ //some plugins and models
],
frame: true,
store: {
model: 'Foresto.model.RentsListModel',
autoLoad: true,
pageSize: 0,
proxy: {
type: 'ajax',
url: '/api/renter/',
reader: {
type: 'json',
rootProperty: 'results'
}
}
},
plugins: [{
type: //someplugins}
],
/* toolbarConfig: {
xtype:'titlebar',
docked:'top',
items:[{
xtype:'button', // it is don't work
ui:'decline',
text:'decline',
align: 'right',
action:'cancel'
}]
}, */
columns: [{
text: 'id',
dataIndex: 'id'
}, {
text: 'document',
dataIndex: 'document',
editable: true,
flex: 1
}, {
text: 'document_num',
dataIndex: 'document_num',
editable: true
}, {
text: 'legal_type',
dataIndex: 'legal_type',
editable: true
}, {
text: 'fio_represent',
dataIndex: 'fio_represent',
editable: true
}, {
text: 'position_represent',
dataIndex: 'position_represent',
editable: true,
}, {
text: 'certificate',
dataIndex: 'certificate',
editable: true,
}]
});
Here is an example of a grid with a custom form:
https://fiddle.sencha.com/#view/editor&fiddle/2ojt
// model
Ext.define('Fiddle.model.Document', {
extend: 'Ext.data.Model',
fields: [{
name: 'id',
type: 'int'
}, {
name: 'document',
type: 'string'
}, {
name: 'type',
type: 'string'
}]
});
//view (grid)
Ext.define('Fiddle.view.DocumentGrid', {
extend: 'Ext.grid.Panel',
xtype: 'documentlist',
store: {
model: 'Fiddle.model.Document',
data: [{
id: 1,
document: 'My First Doc',
type: 'pdf'
}, {
id: 2,
document: 'My Second Doc',
type: 'pdf'
}]
},
columns: [{
text: 'id',
dataIndex: 'id'
}, {
text: 'Document',
dataIndex: 'document',
flex: 1
}, {
text: 'Type',
dataIndex: 'type',
}]
});
var form = Ext.create('Ext.form.Panel', {
title: 'Form',
region: 'east',
layout: {
type: 'vbox',
algin: 'stretch'
},
collapsible: true,
bodyPadding: 10,
hidden: true,
items: [{
xtype: 'textfield',
name: 'document',
fieldLabel: 'Document'
}, {
xtype: 'combo',
name: 'type',
fieldLabel: 'type',
store: ['pdf', 'doc', 'docx', 'odf']
}],
buttons: [{
text: 'Save',
handler: function () {
form.updateRecord();
form.hide();
}
}]
});
var grid = Ext.create('Fiddle.view.DocumentGrid', {
title: 'Document Grid',
region: 'center',
listeners: {
selectionchange: function (selModel, selection) {
if (Ext.isEmpty(selection)) {
form.hide();
return;
}
form.loadRecord(selection[0]);
form.show();
}
}
});
Ext.application({
name: 'Fiddle',
launch: function () {
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
layout: 'fit',
layout: 'border',
width: 600,
height: 600,
items: [
grid, form
]
});
}
});

ExtJS Assigning value to the hidden field

I have the below combobox set to put some records through API call and then display on the page. I need to submit 2 values when user clicks submit, 1) gmiExchangeCode and 2) gmiFuturesCode. The first value works through this form's field, the gmiFuturesCode doesn't work on updating the hidden form field.
}, {
xtype: 'combo',
autoLoad: true,
hideTrigger: true,
fieldLabel: 'Product',
displayField: 'gmiDescription',
valueField: 'gmiExchangeCode',
submitValue: true,
name: 'exchange',
queryMode: 'remote',
queryParam: 'entry',
typeAhead: true,
minChar: 2,
tpl: new Ext.XTemplate('<tpl for="."><div class="x-boundlist-item" style="border-bottom:1px solid #757575;">{gmiExchangeCode} - {lisaMarket} - {gmiFuturesCode} - {gmiDescription}</div></tpl>'),
store: {
fields: ['text', 'value'],
proxy: {
type: 'ajax',
url: 'API',
reader: {
type: 'json'
}
}
},
listeners: {
select: function (combo, record, index) {
hidden.setValue(record.get('gmiFuturesCode'));
}
}
}, {
xtype: 'hidden',
id: 'futures',
name: 'futures'
}, {
There is nothing called "hidden.setValue()" you have to get the object using the query selector or Ext.getCmp('ObjectID')
Here is a working Example Fiddle
Ext.create('Ext.form.Panel', {
title: 'test',
width: 400,
height: 300,
renderTo: Ext.getBody(),
items: [{
xtype: 'combobox',
reference: 'states',
publishes: 'value',
fieldLabel: 'Select State',
displayField: 'displayField',
anchor: '-15',
store: {
fields: ['valueField', 'displayField'],
data: [
['1', 'MyDisplayValueFor1'],
['2', 'MyDisplayValueFor2'],
['3', 'MyDisplayValueFor3']
]
},
minChars: 0,
queryMode: 'local',
typeAhead: true,
listeners: {
select: function (combo, record, index) {
console.log(record.get('displayField'));
Ext.getCmp('futures').setValue(record.get('displayField'));
Ext.Msg.alert('Alert', 'The hidden Field value from the getter is : ' + Ext.getCmp('futures').getValue());
}
}
}, {
xtype: 'hidden',
id: 'futures',
name: 'futures'
}]
})
Try this
Ext.getCmp('futures').setValue(record.get('gmiFuturesCode'));

extjs form,combo and hiddenname

Have this code.
Ext.define('App.v2.model.Things', {
extend: 'App.v2.model.Base'
,fields: [{
name: 'C'
,type:'int'
},{
name:'NAME'
,type:'string'
},{
name:'SHORT_NAME'
,type:'string'
}]
,proxy:{
url:'/data/data1.php'
,reader : {
rootProperty: 'data'
},
extraParams: {
limit: 1000
}
},
idProperty: 'C'
});
model for document
Ext.define('App.v2.model.ThingsList', {
extend: 'App.v2.model.Base'
,fields: [{
name: 'C'
,type:'int'
},
{
name: 'THING_ID',
type:'int'
},
{
name: 'ZE',
type:'int'
},
{
name: 'HS',
type:'int'
},
{
name: 'THING_NAME',
type:'string'
},]
,proxy:{
url:'/data/thingsList.php'
,reader : {
rootProperty: 'data'
}
},
idProperty: 'C'
});
Form config
items: [{
xtype: 'form',
bodyStyle: 'border:none',
defaultType: 'textfield',
layout: 'fit',
maindata: [{
xtype: 'panel',
//layout: 'vbox',
layout: 'vbox',
id: 'ThingsForm',
items: [{
xtype: 'textfield',
fieldLabel: 'ЗЕ',
name: 'ZE',
width: 400,
allowBlank: false
},
{
xtype: 'textfield',
fieldLabel: 'HS',
name: 'HS',
width: 400,
allowBlank: false
},
{
xtype: 'combo',
fieldLabel: 'Thing',
name: 'THING_ID',
hiddenName: 'THING_NAME',
valueField: 'C',
displayField: 'SHORT_NAME',
store : {
model:'App.v2.model.Things',
autoLoad: true,
}
}
//]
]
}]
}]
load data to form
row = grid.store.getAt(this.conf.grid.getSelectionModel().getCurrentPosition().rowIdx);
form = this.down('form').getForm();
form.loadRecord(row);
all good. Form show values
after change of form try to update record
var record = form.getRecord(); // see old values of THING_ID and THING_NAME
record.set(form.getValues()); // see new value of THING_ID and OLD value of THING_NAME
How update THING_NAME to NEW value (TEXT) selected on COMBO in record?
only like describe there?
ExtJS 5 combobox - submitting both value and text

extjs 3.4 data not displaying from a popup grid to the main grid

I have a grid in which I want to filter some results. For filtering the result a popup is opened and the user can select the search criteria and filter the results. The php file is executed as well as the result is returned to the popup, but it is not displaying in the main grid. Here is my code.
This code displays the grid and is displaying the result when the user selects the radio button for filtering purpose :
var checkModel = new xg.CheckboxSelectionModel();
var orderGridPanel = {
id: 'orderGridPanel',
xtype: 'editorgrid',
title: 'Orders',
height:350,
clicksToEdit: 2,
frame: true,
viewConfig: {
forceFit:true
},
cm: new xg.ColumnModel({
defaults: {
width: 120,
sortable: true
},
columns: [
{header:"nr",dataIndex:'nr',hidden:true}
,checkModel
,{header:"Order Id",dataIndex:'order'}
,{header:"Order Date",dataIndex:'date', renderer:Ext.util.Format.dateRenderer('m/d/Y')}
,{id:'created_by',header:"Order By",dataIndex:'created',align:'left'}
,{id:'order_type',header:"Order Source",dataIndex:'order',align:'left'}
,{header:"Order Type", dataIndex:'category'}
,{header:"Sub Category",dataIndex:'sub_cate_nm'}
,{header:"Item",dataIndex:'item'}
,{header:"Properties",dataIndex:'order'}
,{header:"Status",dataIndex:'order'}
,{header:"Action",renderer: renderViewResults}
]
}),
sm: checkModel,
store: new Ext.data.Store({
root: 'results',
method: 'POST',
autoSave: false,
batch: true,
proxy: new Ext.data.HttpProxy({
api: {
read: 'results.php?task=LISTING',
create: 'results.php?task=CREATE',
update:'results.php?task=UPDATE',
destroy: 'results.php?task=DELETE'
}
}),
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: true,
batch: true
}),
reader: new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'nr',
root: 'results',
fields: ['nr','order','date', 'created', 'type', 'category', 'sub_category_nm', 'item', 'properties', 'status']
}),
baseParams: ahist_order_params
}),
bbar:[
'-',{
text: 'Add',
iconCls: 'icon-add',
handler: function(){
editMoreData(0);
}
},
'-', {
text: 'Search',
iconCls: 'icon-search',
handler: function(){
displaySearchFilter(origid);
}
},
'-',{
text: 'Sign Orders',
iconCls: 'icon-warning',
handler: function(){
displaySearchFilter();
}
},
'-',{
text: 'Cancel',
iconCls: 'icon-delete',
handler: function(){
displaySearchFilter();
}
},
'-', {
text: 'Refresh',
iconCls: 'icon-table_refresh',
handler: function(){
Ext.getCmp('orderGridPanel').stopEditing(false);
var rs = orderGridPanel.store.getModifiedRecords();
if (rs.length > 0) {
var status = window.confirm("Some data modified on grid, do you want to save grid data before loading latest data ?");
if (status){
orderGridPanel.store.save();
}
}
orderGridPanel.store.load();
}
},
'-', {
text: 'Print',
iconCls: 'icon-print',
handler: function(){
statusStr = getHistGridSelection();
}
}
,'->'
,'Display:','-',
{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_1',
inputValue: 1,
boxLabel: 'Open Orders',
handler: onChangeLoadFilter ,
checked : true
},'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_2',
inputValue: 2,
boxLabel: 'All Orders',
handler: onChangeLoadFilter
},'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_3',
inputValue: 3,
boxLabel: 'Orders 5 days back',
handler: onChangeLoadFilter
}
,'-',{
xtype: 'radio',
name: 'search_filter',
id:'search_filter_4',
inputValue: 4,
boxLabel: 'Cancelled Orders',
handler: onChangeLoadFilter
}
]
};
Now when I click on the search button this code executes:
function displaySearchFilter(id){
var formPanel = new Ext.FormPanel({
frame: true,
labelWidth:150,
bodyStyle: 'padding:5px 5px 0',
items: [{
xtype: 'fieldset',
defaultType: 'textfield',
items: [
{
xtype : 'container',
border : false,
layout : 'column',
anchor : '100%',
style : 'margin-top:8px;margin-bottom:8px;',
defaultType : 'field',items :[
{
xtype: 'label',
style: 'float: left; margin-left:3px;margin-top:3px;',
text: 'From'
},
{
fieldLabel: 'From Date',
xtype: 'datefield',
id: 'from_date',
style: "float: left; margin-left:3px;",
width:70
},
{
xtype: 'label',
style: 'float: left; margin-left:5px;margin-top:3px;',
text: 'To'
},
{
fieldLabel: 'To Date',
xtype: 'datefield',
id: 'to_date',
style: 'float: left; margin-left:5px;',
width:70
},
{
xtype: 'label',
style: 'float: left; margin-left:5px;margin-top:3px;',
text: 'Patient'
},
{
fieldLabel: 'Patient ID',
id:'patient',
xtype: 'textfield',
style: 'float: left; margin-left:5px;',
value: btpacs.data.Origid,
mode:'local'
},
{
xtype:'label',
style:'float:left;margin-left:5px;margin-top:3px;',
text:'Display'
},
{
xtype:'combo',
id:'search_filter',
store:btpacs.data.searchFilter,
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
lastQuery: '',
emptyText:'Select an option...',
width : 120
}
]},
{
xtype: 'combo',
fieldLabel: 'Order Type',
name: 'category',
id:'cat',
store: btpacs.data.CpoeCategory,
hiddenName: 'category',
triggerAction: 'all',
emptyText:'Select an option...',
width : 300,
mode: 'local',
lastQuery: '',
listeners : {
select : function (f, e){
//params: { cat_id: Ext.getCmp('cat').getValue()}
//subCategoryStore.load();
var category_id = Ext.getCmp('cat').getValue();
subCategoryStore.reload({
params: { cat_id: category_id}
});
}
}
},
{
xtype: 'multiselect',
fieldLabel: 'Sub Category',
name: 'sub_category',
id:'sub_cat',
displayField: 'sub_cat_name',
valueField: 'sub_cat_id',
store: subCategoryStore,
hiddenName: 'sub_category',
emptyText:'Select Order Type First...',
triggerAction: 'all',
width : 300,
mode: 'local',
listeners : {
click : function (f, e){
var sub_cat_id = Ext.getCmp('sub_cat').getValue();
itemStore.reload({
params: { sub_cat_ids: sub_cat_id}
});
}
}
},
{
xtype: 'multiselect',
fieldLabel: 'Items',
name: 'items',
displayField: 'item_name',
valueField: 'item_id',
store:itemStore,
hiddenName: 'items',
triggerAction: 'all',
width : 300,
mode: 'local'
},
{
xtype : "multiselect",
fieldLabel : "Doctor List",
id: 'placed_doctor_name',
displayField: 'name',
valueField: 'name',
typeAhead: true,
mode: 'local',
triggerAction: 'all',
selectOnFocus: true,
lastQuery: '',
store:doctorStore,
width : 300
}]
}],
buttons: [{
text: 'Search',handler: function() {
formPanel.getForm().submit({
method: 'POST',
url: 'ajax/results.php?task=SEARCH', // when this file is executed the result is return properly as I want
root: 'results',
params : {'origid': origid},
success: function(f, a) {
// after the result is successfully returned I cannot display it here.I am not sure what I am missing.Here I want to assign all the result to orderGridPanel
win.close();
},
failure: function(f, a) {
alert("Request failed");
f.markInvalid(a.result.errors);
}
});
}
},
{
text: 'Cancel',
handler: function () {
win.close();
}
}]
});
win = new Ext.Window({
layout: 'fit',
width: 650,
height: 520,
defaults: {
autoScroll: true
},
closeAction: 'close',
title: 'Search Orders',
plain: true,
items: [formPanel]
});
win.show();
}
Thanks in advance.
You need to load the data into the store of the grid if you want the grid to display the data.

ExtJS4 Reload grid Panel in button handler

I'm working with ExtJS4 and trying to build a search feature using a form. I've got the form displayed and a user enters one of 4 criteria and clicks Search, the grid is then built and shows the results from a JSON call.
What I'm trying to achieve is to allow the user to be able to enter different search criteria and click Search again and have the grid updated to show the new results. In my first attempt the grid is rendered for each click of Search and in my second attempt it simply pushes the results of the search into the grid without removing the previous entries.
Here's my current setup:
Ext.define('job',{
extend:'Ext.data.Model',
fields:['account_name', 'account_number','job_number','contract_year','program','type', 'version']
})
Ext.onReady(function(){
var formPanel = Ext.widget('form', {
renderTo: 'search',
frame: true,
width: 350,
bodyPadding: 5,
bodyBorder: false,
title: 'Search',
defaults: {
anchor: '100%'
},
{
xtype: 'combo',
name: 'jobyear',
fieldLabel: 'Job Year',
store:
new Ext.data.SimpleStore({
fields: ['year'],
data: [
['2008'],['2009'],['2010'],['2011'],['2012']
] //end of data
}),
displayField: 'year',
typeAhead: true,
emptyText: 'Select a year'
}], //end of items
dockedItems: [{
xtype: 'container',
dock: 'bottom',
layout: {
type: 'hbox',
align: 'middle'
},
padding: '10 10 5',
items: [{
xtype: 'component',
id: 'formErrorState',
baseCls: 'form-error-state',
flex: 1
}, {
xtype: 'button',
formBind: true,
id: 'search',
disabled: true,
text: 'Search',
width: 140,
height: 35,
handler: function() {
var columns = [
{xtype: 'rownumberer',sortable: true},
{text: 'School Name', sortable:true,dataIndex:'account_name'},
{text: 'Acct Number', sortable:true,dataIndex:'account_number'},
{text: 'Job Number',sortable:true,dataIndex:'job_number'},
{text: 'Version',sortable:true,dataIndex:'version'},
{text: 'Contract Year',sortable:true,dataIndex:'contract_year'},
{text: 'Program', sortable:true,dataIndex:'program'},
{text: 'Job Type', sortable:true,dataIndex:'type'}
]; // end columns
var userGrid = new Ext.grid.Panel({
id: 'FOO',
multiSelect:true,
store: store,
columns: columns,
stripeRows: true,
title: 'Results',
renderTo: Ext.get('results'),
dockedItems: [{
xtype: 'pagingtoolbar',
store: store,
dock: 'bottom',
displayInfo: true
}],
})
var form = this.up('form').getForm();
var store = new Ext.data.Store({
model: 'job',
pageSize: 10,
autoLoad: true,
remoteSort:true,
proxy: {
actionMethods: {
read: 'POST'
},
type: 'ajax',
fields: ['job_number', 'account_name', 'account_number', 'contract_year','program','type','version'],
url: '/search?'+ form.getValues(true),
reader:{
type: 'json',
root: 'results',
totalProperty: 'totalCount'},
}, //end proxy
sorters:[{
property:'version',
direction:'ASC'
}]
}).on('load', function(){
userGrid.reconfigure(this); // ???
});
} // end button handler
}] //end items
}] // end dockeditems
});
});
I've tried refreshing the grid and calling load() but I don't think I've hit yet on the right combination. I'd like the grid contents to be replaced with those from the latest ajax call to /search.
You should not create a new panel and a store on each search button click, so move it out of the button handler. If you just call load({params:{search:'whatever'}}) on the store of the grid when user pushes search button you will get the new data populated in your grid automatically. You don't need to reconfigure the grid or do anything else. Essentially the grid is bound to the store and when the store data changes the view behind the grid will automatically refresh.
I got this solved by following some of DmitryB's advice. I inherited this code and after some massaging I got it working as intended. Below is my final solution. In the handler function on the button you need to be sure and update the URL of the proxy defined in the store so that when you call store.load() it's correct.
Ext.require([
'Ext.form.*',
'Ext.grid.*',
'Ext.data.*',
'Ext.dd.*'
//'extjs.SlidingPager'
]);
/*Setup Data Model*/
Ext.define('job',{
extend:'Ext.data.Model',
fields:['account_name', 'account_number','job_number','contract_year','program','type', 'version']
})
Ext.onReady(function(){
var formPanel = new Ext.widget('form', {
renderTo: 'search',
frame: true,
width: 350,
bodyPadding: 5,
bodyBorder: false,
title: 'Search',
defaults: {
anchor: '100%'
},
fieldDefaults: {
labelAlign: 'left',
msgTarget: 'none'
},
items: [{
xtype: 'textfield',
name: 'jobnumber',
fieldLabel: 'Job Number',
allowBlank: true,
minLength: 7,
maxLength: 7
}, {
xtype: 'textfield',
name: 'accountnumber',
fieldLabel: 'Account Number',
allowBlank: true,
minLength: 6,
maxLength: 7
}, {
xtype: 'textfield',
name: 'customername',
fieldLabel: 'Customer Name',
allowBlank: true,
}, {
xtype: 'combo',
name: 'jobyear',
fieldLabel: 'Job Year',
store:
new Ext.data.SimpleStore({
fields: ['year'],
data: [
['2008'],['2009'],['2010'],['2011'],['2012']
] //end of data
}),
displayField: 'year',
typeAhead: true,
emptyText: 'Select a year'
}], //end of items
dockedItems: [{
xtype: 'container',
dock: 'bottom',
layout: {
type: 'hbox',
align: 'middle'
},
padding: '10 10 5',
items: [{
xtype: 'button',
formBind: true,
id: 'search',
disabled: true,
text: 'Search',
width: 140,
height: 35,
handler: function() {
store.proxy.url = '/search?' + formPanel.getForm().getValues(true)
store.load();
} // end button handler
}] //end items
}] // end dockeditems
});
var store = new Ext.data.Store({
model:'job',
pageSize:10,
autoLoad: false,
remoteSort:true,
proxy:{
type:'ajax',
fields:['job_number', 'account_name', 'account_number', 'contract_year','program','type','version'],
url: '',
reader:{
totalProperty:'totalCount',
type: 'json',
root: 'results'
},
actionMethods: 'POST'
},
sorters:[{
property:'version',
direction:'ASC'
}]
});
var columns = [
{xtype: 'rownumberer',sortable: true},
{text: 'School Name', sortable:true,dataIndex:'account_name'},
{text: 'Acct Number', sortable:true,dataIndex:'account_number'},
{text: 'Job Number',sortable:true,dataIndex:'job_number'},
{text: 'Version',sortable:true,dataIndex:'version'},
{text: 'Contract Year',sortable:true,dataIndex:'contract_year'},
{text: 'Program', sortable:true,dataIndex:'program'},
{text: 'Job Type', sortable:true,dataIndex:'type'}
]; // end columns
var userGrid = new Ext.grid.Panel({
id: 'userGrid',
multiSelect: false,
store: store,
columns: columns,
stripeRows: true,
title: 'Results',
renderTo: 'results',
dockedItems: [{
xtype: 'pagingtoolbar',
store: store,
dock: 'bottom',
displayInfo: true
}],
})
});

Resources