English 中文(简体)
• 如何将控制器的价值转至塞察触点的数据储存
原标题:How to pass value from controller to data store in sencha touch

有些人可以告诉我,如何把数据从控制器传送到塞察触点的数据储存。

观点守则

var select = new Ext.form.Select({
    id: selectCity ,
    store: parking.stores.city,
    displayField:  Name ,
    valueField:  Name ,
    placeHolder:  Choose City ,
    cls: select 
});

var citySearchButton = new Ext.Button({
    cls:  citySearch ,
    text:  Search ,
    handler: function () {
        Ext.dispatch({
            controller: parking.controllers.controller,
            action:  showMapBasedOnCity ,
            id: Ext.getCmp( selectCity ).getValue()
        });
    }
});

从我的观点看,我能够把价值传给控制员。

 showMapBasedOnCity: function (options) {
        var city = options.id;
        //var data = parking.stores.parkingFacilityByCity.setId(city);
        // parking.views.map.addMap(city);
        parking.views.viewport.setActiveItem(
            parking.views.map, options.animation
        );

    },

The problem is how to pass the value from here to the data store : I need the parameter from controller (the city value) to pass to my jsonp query to get the desired result back).

parking.stores.parkingFacilityByCity = new Ext.data.Store({
    model:  PF ,
    proxy: Ext.util.JSONP.request({
        url:  http://parking.511.org/index/M_GetParkingFacilityByCity ,
        callbackKey:  callback ,
        parmas: { city: },
        scope: this,
        callback: function (data) {
            var list = data.Root;
            parking.stores.parkingFacilityByCity.loadData(data.Root);
        }
    })
});

任何帮助都将受到高度赞赏。

Thanks, Pawan

最佳回答

In my Form on button click i get the value from and pass it on to the dispatch method. In the dispatch method i call the controller.

var select = new Ext.form.Select({
    id: selectCity ,
    store: parking.stores.city,
    displayField:  Name ,
    valueField:  Name ,
    placeHolder:  Choose City ,
    cls: select 
});

var citySearchButton = new Ext.Button({
    cls:  citySearch ,
    text:  Search ,
    handler: function () {
        Ext.dispatch({
            controller: parking.controllers.controller,
            action:  showMapBasedOnCity ,
            id: Ext.getCmp( selectCity ).getValue()
        });
    }
});

在控制器中,这种方法通过城市进入停车场,使新数据输入仓库。

  showMapBasedOnCity: function (options) {
        var city = options.id;
        getParkingFacilityByCity(city);
     //   parking.views.map.addMap();
        parking.views.viewport.setActiveItem(
            parking.views.map, options.animation
        );

数据档案

parking.stores.parkingFacilityByCity = new Ext.data.Store({
    model:  PF ,
    autoload: true
});

var getParkingFacilityByCity = function (cityName) {
    Ext.util.JSONP.request({
        url:  http://parking.511.org/index/M_GetParkingFacilityByCity ,
        callbackKey:  callback ,
        params: { city: cityName },
        callback: function (data) {
            parking.stores.parkingFacilityByCity.loadData(data.Root);
        }
    });
};

希望有助于有些人。 可能还有其他方法。 但是,这是对我来说很出色的工作。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签