PDA

View Full Version : data can not be displayed



starstar
11 Jan 2010, 9:45 PM
I use gridpanel to display the data from Database.
Sometimes it displays OK, but sometimes no data is displayed in the grid. I need to refresh 2-3 times, the data display again.

Does anybody know why and tell me the solution? Thank you.

starstar
11 Jan 2010, 10:22 PM
I use Windows 2003 server, IIS, IE7.0.

jsemmanuel
11 Jan 2010, 10:32 PM
You may have to observe the data returned from the server for the ajax calls (which i presume you are making) Dunno about IE, but in firefox, with firebug install, you can track it in the console tab. There must be a similar tool for ie, or maybe in the developer tab/tools somewhere.

starstar
11 Jan 2010, 10:35 PM
Thank you~

starstar
12 Jan 2010, 7:31 PM
I know the reason. I use 'EditorGridPanel'.
If I only use 'TextField' in the grid, all the data can be shown each time.
If I use 'ComboBox', the data can not be shown each time. Who know the reason?

starstar
14 Jan 2010, 12:56 AM
source code

var genre_model= Ext.data.Record.create([
'id', 'code' ]);
var genrestore = new Ext.data.Store({
url: 'genre.asp',
reader: new Ext.data.JsonReader({
root:'rows',
id:'id'
}, genre_model)
});

genrestore.load();

function genre_name(val){
return genrestore.queryBy(function(rec){
return rec.data.id == val;
}).itemAt(0).data.code;
}

var genre_edit = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
mode: 'local',
store: genrestore,
displayField:'code',
valueField: 'id' });


var grid = new Ext.grid.EditorGridPanel({
renderTo: document.body,
frame:true,
title: 'Movie Database',
height:300,
width:520,
enableColumnMove: false,
store: store,
clicksToEdit: 2,
columns: [
{header: "Title", dataIndex: 'title', editor: title_edit},
{header: "Genre", dataIndex: 'id', renderer: genre_name, editor: genre_edit},
{header: "Tagline", dataIndex: 'tagline', editor: tagline_edit}
],
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),......

starstar
14 Jan 2010, 12:58 AM
I use ASP, Windows Server 2003, IIS

The red part can not get value successfully each time.

Help~

starstar
14 Jan 2010, 1:00 AM
if I use

if (genrestore.getcount()>0) {...} sometimes it return false.

If I use an array (not json data), it can get the value every time.

dotcomuser
14 Jan 2010, 1:20 AM
To use getcount method you have to make it on "onload" event

starstar
14 Jan 2010, 1:24 AM
To use getcount method you have to make it on "onload" event for the store

yes. I use there can get>0 true each time~

But when display the combo box, it is not successful each time.

See red part code.

starstar
14 Jan 2010, 6:31 AM
who can help me? sometime the record can not be gotten from the store, why?

starstar
14 Jan 2010, 11:03 PM
~~~~~~~~:)