PDA

View Full Version : Data not display in list



maulik
23 Jan 2011, 9:45 PM
i am new in sencha.. and i want to display data in list. i m using JSON reader to read data from server.. but still i cant display data in list.. i dont konw where i was wrong.. here my code..

i include this files in my html file..

news.html

<link rel="stylesheet" href="lib/touch/resources/css/sencha-touch-debug.css" type="text/css"/>
<script type="text/javascript" src="lib/touch/sencha-touch-debug-w-comments.js"></script>

<link rel="stylesheet" href="sencha-touch.css" type="text/css"/>
<script type="text/javascript" src="sencha-touch.js"></script>

<script type="text/javascript" src="lib/touch/docs/resources/ext-base.js"></script>
<script type="text/javascript" src="lib/touch/docs/resources/ext-all.js"></script>

// Application file..
<script type="text/javascript" src="index.js"></script>

news.js

Ext. setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'phone_startup.png',
icon: 'icon.png',
glossOnIcon: false,
onReady: function()
{
var ds;
ds = new Ext.data.Store({autoLoad: true,
model:'status',
proxy: new Ext.data.HttpProxy({
url: 'url of server',
method: 'GET'
}),
reader: new Ext.data.JsonReader({
totalProperty: 'totalCount',
id: 'linie',
root: 'result',
fields:['linie','status']
}),
listeners: {'load': function ()
{
ds.each(function(r) {
alert(r.data['linie']);

});
}
},
getGroupString : function(record) {
return record.get('linie')[0];
}
});

Ext.regModel('Status', {
fields: ['linie', 'Status']
});

var list = new Ext.List({
fullscreen: true,
singleSelect : true,
itemTpl : '{linie} - {Status}',
//grouped : true,
indexBar: true,
store: ds,

});

var dockedList = [{
xtype: 'tabpanel',
dock: 'center',
fullscreen: true,
items:[{
title: 'Status',
html: '<p>test 1</p>',
dockedItems:list
},
{
title: 'News',
html: '<p>test 2</p>'

}]
}]

var appPanel = new Ext.Panel({
id: 'appPanel',
fullscreen: true,
dockedItems: dockedList
});
}
});


plz.. help me to get out from this problem.. thanx in advance... rply as soon as possible.

AndreaCammarata
24 Jan 2011, 2:22 AM
Hi maulik.
Before to take a look at your code, could you even provide your json data you want to read?
(your server side script output)

maulik
24 Jan 2011, 3:45 AM
thanx andreacammarata for your quick reply...

i want to display just linie and status from server..

here my server side script output..

{"totalCount":"3","result":[{"linie":"XYZ","status":"1","time":"2011-01-19 04:57:03"},{"linie":"PQR","status":"2","time":"2011-01-19 04:57:13"},{"linie":"ABC","status":"3","time":"2011-01-19 05:09:56"}]}

again thanx for quick rply.. waiting for your reply..
thanx