Create a Table “Employee” with following fields in Mysql:
ID, FirstName, LastName, Salary
After that you need to create a php file “data-file.php” with script for listing table contents.
Then we need to create a Datastore to connect our php file data_file.php:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
EmployeeDataStore = new Ext.data.Store({ id: 'EmployeeDataStore', proxy: new Ext.data.HttpProxy({ url: 'data_file.php', // PHP file to connect to database or an array with data method: 'POST' }), baseParams:{task: "LIST-ALL"}, // this parameter asks for listing reader: new Ext.data.JsonReader({ // we tell the datastore where to get his data from root: 'results', totalProperty: 'total', id: 'id' },[ {name: 'ID', type: 'int', mapping: 'ID'}, {name: 'FirstName', type: 'string', mapping: 'firstname'}, {name: 'LastName', type: 'string', mapping: 'lastname'}, {name: 'Salary', type: 'float', mapping: 'salary'} ]), sortInfo:{field: 'ID', direction: "ASC"} }); |
Incoming search terms:
- sencha store php




