I am stuck with the pagination in EXT js 4.1.0. I implemented the pagination its showing the proper count but grid is not updating as per the pages refresh.
Ext.define('person', {
extend: 'Ext.data.Model',
fields: [
// the 'name' below matches the tag name to read, except 'availDate'
// which is mapped to the tag 'availability'
{name: 'sso', type: 'string'},
{name: 'fname', type: 'string'},
// dates can be automatically converted by specifying dateFormat
{name: 'lname', type: 'string'},
{name: 'msso', type: 'string'},
{name: 'email_address', type: 'string'},
{name: 'person_status', type: 'string'}
]
});
var ds = new Ext.data.Store({
model:'person',
autoLoad: true,
//url:'/FormAction',
actionMethods: {create: "POST", read: "POST", update: "POST", destroy: "POST"},
proxy: {
type: 'ajax',
url: '/identityiq/FormAction',
reader: {
type: 'xml',
record: 'record'
},
}
});
ds.load({
params:{
start:0,
limit: 25
}
});
var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
validateedit: function(editor, e) {
//alert('New value (validateedit): ' + e.value);
},
edit: function(editor, e) {
//alert('Old value (edit): ' + e.value);
}
}
});
// create the Grid
var grid = Ext.create('Ext.grid.Panel', {
store: ds,
dockedItems:[
{
xtype: 'pagingtoolbar',
pageSize: 25,
store:ds,
dock: 'bottom',
displayInfo: true,
displayMsg:'Displaying records {0} - {1} of {2} ',
emptyMsg:"No records to display ",
flex:1
}
], columns: [
{
text : 'SSO',
width:80,
sortable : true,
dataIndex: 'sso'
},
{
id: 'fname',
header: 'First Name',
dataIndex: 'fname',
width:100,
field: {
allowBlank: false
}
},
{
id: 'lname',
header : 'Last Name',
width:100,
sortable : true,
dataIndex: 'lname',
field: {
allowBlank: false
}
},
{
text : 'Manager SSO',
width : 80,
sortable : true,
dataIndex: 'msso'
},
{
text : 'Email Address',
width : 200,
sortable : true,
dataIndex: 'email_address'
},
{
text : 'Personstatus',
width : 80,
sortable : true,
dataIndex: 'person_status'
}
],
selModel: {
selType: 'cellmodel'
},
height: 400,
width: 700,
title: 'Array Grid',
renderTo: 'myDiv',
viewConfig: {
stripeRows: true,
enableTextSelection: true
},
frame: true,
plugins: [cellEditing],
tbar: [
{
text: 'Save',
handler: function ()
{
alert(ds.getModifiedRecords());
console.log(ds.getModifiedRecords());
var modified_data ={};
modified_data = ds.getModifiedRecords();
for (var i = 0; i < modified_data.length; i++) {
var record = modified_data[i];
alert(record.data.fname);
}
}
}
],
});
Tried different versions given in the different forums but no luck. Grid don't refresh with the change in the pages.
Also will there need any change in server side for implementing pagination.
Thanks in Advance.
- Ash
Thanks for reply. Please find my server side code, its a simple Servlet with this process method - Please suggest me what i need to change in order to work pagination.
try {
ServletOutputStream sos = response.getOutputStream();
response.setHeader("Cache-Control","no-store");
response.setHeader("Pragma","no-cache");
response.setContentType("text/xml");
String query="select * from table'";
OracleDataSource ods = new OracleDataSource();
Connection conn = ods.getConnection();
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery(query);
sos.println("<dataset>");
while(rs.next()) {
sos.println("<record>");
sos.println("<sso>"+ rs.getString("person_num_sso") +"</sso>");
sos.println("<fname>"+ rs.getString("first_name") +"</fname>");
sos.println("<lname>"+ rs.getString("last_name") +"</lname>");
sos.println("<msso>"+ rs.getString("manager_person_num") +"</msso>");
sos.println("<email_address>"+ rs.getString("email_address") +"</email_address>");
sos.println("<person_status>"+ rs.getString("person_status") +"</person_status>");
sos.println("</record>");
}
sos.println("</dataset>");
rs.close();
conn.close();
sos.close();
System.out.print("Done list servlet");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}