Cửa hàng Sencha Touch 2 đạt kỷ lục (Sencha Touch 2 store get record)


問題描述

Cửa hàng Sencha Touch 2 đạt kỷ lục (Sencha Touch 2 store get record)

I have a problem.

I have 2 store files (1 event and 1 places). I'm loading these stores from a database. Now the problem is that in the event store there is a field called {id_place}. This field contains a number which is also a number in the places store. Now what I need to do is get the name from the place of the {id_place}. So the {name} is a field in the places store. So what I need is a function to get a record from another store and then get the {name} from that store. So I send the id_place to the placestore, then I need to find the record with that id and I need to get the field {name} from that record. I don't know if I'm making sense, it's kinda hard to explain. I hope this can be done.

Thanks in advance!

Edit:

showPlace: function(id_place){
                var placeUrl = 'http://admin.hishanghai.info/sencha/places.php?action=read&callback=callback&id=' + id_place;
                store = new Ext.data.Store({
                    model: 'android.model.Placesmodel',

        autoLoad: true,
                    proxy: {
                        type: 'scripttag',
                        url: placeUrl,
                        reader: {
                            type: 'json',
                            rootProperty: 'place'
                        },
                        extraParams: {
                            action: 'read'
                        }
                    }

                })
                //var naam = Ext.getStore('Placesstore').getById('id_place').get('name')
                //var Record = store.getAt(id_place);
                //var naam = store.getById('id_place').get('name');
                var naam = store.get('name');
                return naam;

                 }

This code creates a store with the info from 1 record. Now I only need to access the name field. how do i do that?


參考解法

方法 1:

found it:

 showPlace: function(id_place){
            var placesstore = Ext.getStore('Placesstore');
            var i =0;
            var placeid = 0;
            var aRecord;
            while(placeid != id_place){
                aRecord = placesstore.getAt(i);
                placeid = aRecord.data.id;
                i+=1;
                }
            var naam = aRecord.data.name;
            return naam;
             }

(by Bjorn RaversBjorn Ravers)

參考文件

  1. Sencha Touch 2 store get record (CC BY‑SA 3.0/4.0)

#store #extjs #touch #record #get






相關問題

Sencha touch 2:通過代理在商店檢索信息 (Sencha touch 2: retrieve infos by proxy in store)

Đại diện cửa hàng ExtJS Costum (ExtJS Costum store representation)

Cửa hàng Sencha Touch 2 đạt kỷ lục (Sencha Touch 2 store get record)

更換和存放 (Replacing and Storing)

如何重命名Window Store App的.exe(可執行文件)文件? (How to rename .exe (executable) file of Window Store App?)

Socket.io 和 Extjs:為 Store 檢索數據 (Socket.io and Extjs: Retrieving data for Store)

獲取組件中的輸入值反應本機 (Get a value of input in a component react native)

為小組存儲生產密碼的最佳實踐 (Best practices for storing production passwords for small groups)

有人可以解釋一下 iphone 證書的東西,步驟是什麼樣的嗎? (Can someone explain me the iphone certificate stuff, how the steps look like?)

用戶退出應用程序時在 MapKit 中存儲註釋 (Store annotations in MapKit when user quit application)

使用 Injector angular 7 將 Store 注入子類 (Injecting Store to sub classes using Injector angular 7)

通過 VBA 中的輸入創建數組 (Creath an array by input in VBA)







留言討論