PDA

View Full Version : I encounterde this error on loading data from server to a grid



masoud_tamizy
18 Jan 2012, 9:38 PM
how can i do it ?
i take a pic from it an loaded in the following :
30813



//Ext.require('*');
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.panel.*',
'Ext.form.*',
'Ext.util.*',
'Ext.state.*'
]);

Ext.onReady(function() {
var types = Ext.data.Types; // allow shorthand type access
Ext.define('user', {
extend: 'Ext.data.Model',
fields: [
{ name: 'national_code', type: 'string' },
{ name: 'user_id', type: 'int' },
{ name: 'first_name', type: 'string' },
{ name: 'last_name', type: 'string' },
{ name: 'father_name', type: 'string' },
{ name: 'sh_sh', type: 'string' },
{ name: 'sh_s_sh', type: 'string' },
{ name: 'gender', type: 'string' },
{ name: 'birth_date', type: 'date' },
{ name: 'birth_location', type: 'string' },
{ name: 'email', type: 'email' },
{ name: 'home_address', type: 'string' },
{ name: 'home_phone', type: 'string' },
{ name: 'postal_code', type: 'string' },
{ name: 'job_title', type: 'string' },
{ name: 'job_address', type: 'string' },
{ name: 'job_phone', type: 'string' },
{ name: 'mobile', type: 'string' },
{ name: 'fax', type: 'string' },
{ name: 'comment', type: 'string' }
],
validations: [
{type: 'presence', field: 'national_code'},
{type: 'presence', field: 'first_name'},
{type: 'presence', field: 'last_name'},
{type: 'presence', field: 'father_name'},
{type: 'length', field: 'first_name', min: 1, max:45},
{type: 'length', field: 'last_name', min: 1, max:45},
{type: 'length', field: 'father_name', min: 1 , max:45},
{type: 'inclusion', field: 'gender', list: ['Male', 'Female']},
{type: 'exclusion', field: 'username', list: ['Admin', 'Operator']}
]
});
var userstore = Ext.create('Ext.data.Store', {
id:'userstore',
model: 'User',
autoLoad: true,
autoSync: true,
proxy: {
type: 'ajax',
actionMethods: 'POST',
url : 'prepare.php',
reader : {type:'json',root:'users',successProperty: 'success'}
}
});
// Create the Grid
Ext.create('Ext.grid.Panel', {
store: userstore,
selType: 'rowmodel', // 'cellmodel'
loadMask: true,
plugins: [Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 1,
errorSummary:true})
],
columns: [
{ dataIndex: 'national_code',
hideable: false,
header:'کدملّي',
align:'right' ,
editor : null
},{ dataIndex:'first_name',
text:'نام',
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'last_name',
text:'فاميل',
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'father_name',
text:'نام پدر',
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'sh_sh',
text:'شماره شناسنامه',
align:'right',
sortable:false,
editor: {xtype:'numberfield',allowBlank: false}
},{ dataIndex:'sh_s_sh',
text:'شماره سريال شناسنامه',
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'birth_date',
text:'تاريخ تولذ',
hidden:true,
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'birth_location',
text:'محل تولد',
hidden:true,
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'email',
text:'پست الکترونيک',
hidden:true,
align:'right',
editor: {xtype:'textfield',allowBlank: false}
},{ dataIndex:'home_address',
text:'آدرس منزل',
align:'right'
},{ dtatIndex:'home_phone',
text:'تلفن منزل',
align:'right'
},{ dataIndex:'postal_code',
text:'کد پستي',
align:'right',
},{ dataIndex:'job_title',
text:'شغل',
align:'right',
hidden:true
},{ dataIndex:'job_address',
text:'آدرس محل کار',
align:'right',
hidden:true
},{ dataIndex:'job_phone',
text:'تلفن محل کار',
align:'right',
},{ dataIndex:'mobile',
text:'تلفن همراه',
align:'right'
},{ dataIndex:'fax',
text:'فاکس',
align:'right'
},{ dataIndex:'comment',
text:'توضيحات',
align:'right',
hidden:true
}],
title: 'User List',
height:575,
width:1366,
renderTo: Ext.getBody()
});
});

lorezyra
18 Jan 2012, 9:55 PM
insufficent information...

Please post the code to your store/model... How are you using the store?

masoud_tamizy
18 Jan 2012, 10:30 PM
insufficent information...

Please post the code to your store/model... How are you using the store?
i insert my code , please see it .
and my json recieved from server is :


{"success": true,"users":[{"national_code":"1064044548","user_id":"31","first_name":"saeed","last_name":"tamizi","father_name":"mohsen","gender":"M","birth_date":"2002-12-12","birth_location":"neyshabour","email":"masoud_tamizy@yahoo.com","home_address":"iran","home_phone":"05513338937","postal_code":"9313856469","job_title":"engineer","job_address":"iran","job_phone":"05513356361","mobile":"09158152921","fax":"05513356361","comment":"no comment"},{"national_code":"1064044549","user_id":"30","first_name":"masoud","last_name":"tamizi","father_name":"mohsen","gender":"M","birth_date":"2000-12-12","birth_location":"neyshabour","email":"masoud_tamizy@yahoo.com","home_address":"iran","home_phone":"05513338937","postal_code":"9313856469","job_title":"engineer","job_address":"iran","job_phone":"05513356361","mobile":"09352334746","fax":"05513356361","comment":"no comment"}]}<br>880

masoud_tamizy
18 Jan 2012, 10:47 PM
who know what is this "_dc" in my query string :
http://localhost/Banking/prepare.php?_dc=1326955410989

lorezyra
18 Jan 2012, 11:36 PM
the _dc param is automatically generated by Ext.data.proxy.Server. See the noCache config option for more details.

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.proxy.Server-cfg-noCache

masoud_tamizy
19 Jan 2012, 12:09 AM
the _dc param is automatically generated by Ext.data.proxy.Server. See the noCache config option for more details.

http://docs.sencha.com/ext-js/4-0/#!/api/Ext.data.proxy.Server-cfg-noCache
thanks , "_dc" parameter replace with "page=1&start=0&limit=25" .
but my error not solved yet ! please help me .

chramer
19 Jan 2012, 12:47 AM
try to delete the "actionMethods" property..

masoud_tamizy
19 Jan 2012, 12:56 AM
try to delete the "actionMethods" property..
the problem didn't solve. error there is yet ...

chramer
19 Jan 2012, 1:21 AM
Ext.define('user', {...


var userstore = Ext.create('Ext.data.Store', {
id:'userstore',
model: 'User',
...


That's the problem! Use the same name for both!

masoud_tamizy
19 Jan 2012, 7:02 AM
Please help me to Implementing CRUD in Grid with PHP Mysql in my Code ...

masoud_tamizy
21 Jan 2012, 10:56 PM
Ext.define('user', {...


var userstore = Ext.create('Ext.data.Store', {
id:'userstore',
model: 'User',
...


That's the problem! Use the same name for both!
tnx my friend