Code:
Ext.onReady(function() {
// Initiate the quick tips.
Ext.QuickTips.init();
var jsonReaderSuperWP = new Ext.data.JsonReader( {
root : 'superwps',
idProperty : 'id',
successProperty : 'success',
totalProperty : 'total',
fields : [ {
name : 'id'
}, {
name : 'swpName'
}, {
name : 'lowerLimit'
}, {
name : 'upperLimit'
}, {
name : 'category'
}, {
name : 'description'
} ]
});
var superWPDataStore = new Ext.data.JsonStore( {
storeId: 'super-wps',
baseParams : {
type : "json",
searchall : true
},
url : "getallswps.action",
method : 'POST',
reader : jsonReaderSuperWP
});
var wpForm = new Ext.FormPanel( {
standardSubmit : true,
url : 'createWP',
labelAlign : 'left',
collapsible : true,
title : WP details',
bodyStyle : 'padding:5px',
width : 970,
items : [ {
layout : 'column',
border : false,
items : [ {
// removed other fields
columnWidth : 0.5,
layout : 'form',
border : false,
items : [ {
xtype : 'combo',
fieldLabel : 'Workpackage Category',
name : 'category',
anchor : '93%',
allowBlank:false,
store:superWPDataStore,
loadingText: "loading",
displayField:'category',
valueField:'category',
mode: 'remote',
triggerAction: 'all',
typeAhead: true,
selectOnFocus:false,
forceSelection:true,
minChars: 3,
lazyRenderer: true,
resizable:true,
emptyText: "select"
} ]
// removed other fields
} ],
buttons : [ {
text : 'Save',
}, {
text : 'Cancel',
} ]
});
wpForm.render('loadWP');
alert(superWPDataStore.getTotalCount()); // This says total count is zero even if I set "autoLoad: true" for the store !
Code:
public class SuperWorkPackageAction extends ActionSupport {
/**
*
*/
private Integer id = null;
/**
*
*/
private String swpName = null;
/**
*
*/
private Integer lowerLimit = null;
/**
*
*/
private Integer upperLimit = null;
/**
*
*/
private String category = null;
/**
*
*/
private String description = null;
/**
* The total number of rows to be read by the JSON reader
*/
private int total = 0;
/**
private List superwps = new ArrayList();
/**
* The success or failure property to be read by the JSON reader
*/
private boolean success = true;
/**
*
@return
*/
public String getAllSuperPackages() {
System.out.println("getting all super packages");
superwps = SuperWorkPackages.superWorkPackageList;
System.out.println(superwps.size()); // this says the length is 3
setTotal(superwps.size());
setSuccess(true);
return SUCCESS;
}
// setters and getters below
}