0

I am beginner in mobile application development. In order to start in sencha, I followed the simple tutorial http://jbkflex.wordpress.com/2012/06/18/creating-a-simple-list-in-sencha-touch-2-0/

I setup an IIS folder and add IIS AppPool\DefaultAppPool user with full rights over created web application.

Well, I finished with writing the code (model, store and view) but when I tried to load html page, I have the following error in Chrome:

GET http://localhost/test/data/contact.json?_dc=1365970529423&page=1&start=0&limit=25 404 (Not Found) 

But I have that json file: http://i.imgur.com/ANUS79C.png

Why the file is not loading ? Why just 404 ?

The full complete javascript code:

Ext.application({
    name: 'Sencha',
    launch: function() {
        //creating our model
        Ext.define('Contacts',{
            extend:'Ext.data.Model',
            config: {
                fields:[
                    {name:'firstName' ,type:'string'},
                    {name:'lastName', type:'string'} ,
                    {name:'contactno', type:'string'},
                    {name:'address', type:'string'}
                ]
            }
        });
        //creating our store
        var contactStore = Ext.create('Ext.data.Store', {
            model:'Contacts',
            proxy:{
                type:'ajax',
                url:'data/contact.json',
                reader:'json'
            },
            autoLoad:true
        });
        //console.log("Store: ", moviesStore.data);
        //item template
         var itemTemplate = new Ext.XTemplate(
            '<tpl for=".">',
                '{firstName} {lastName}',
            '</tpl>'
        );

        //creating our List
        var contactList = Ext.create('Ext.dataview.List',{
            title: 'Contact List',
            store: contactStore,
            itemTpl: itemTemplate
        });
        //adding event to List
        contactList.on("itemtap",function(dataView,index,target,record,e){
           var first_name = record.data.firstName;
           var last_name = record.data.lastName;
           var contact = record.data.contactno;
           var address = record.data.address;
           Ext.Msg.alert("Contact: " + contact);
           //console.log(record.data.firstName);
        });

        //adding List to Main UI - Tab Panel
        Ext.create('Ext.tab.Panel',{
            fullscreen:true,
            items:[contactList]
        });
    }
});
4

1 回答 1

0

由于您的应用程序无法找到数据文件,因此会出现此错误。

您尚未指定端口号。请指定端口号,例如 localhost:8080/test/data/contact.json 然后尝试。

于 2013-04-15T18:41:59.700 回答