Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Sencha Touch 2:在nestedList中重新加载树存储以反映用户选择_Javascript_Extjs_Sencha Touch_Sencha Touch 2 - Fatal编程技术网

Javascript Sencha Touch 2:在nestedList中重新加载树存储以反映用户选择

Javascript Sencha Touch 2:在nestedList中重新加载树存储以反映用户选择,javascript,extjs,sencha-touch,sencha-touch-2,Javascript,Extjs,Sencha Touch,Sencha Touch 2,我的应用程序中有一个嵌套列表,当用户做出选择时,他们会被带到带有一些选项的detailCard。其中一个选项是确认其选择。确认后,应将所选内容从列表中删除。这在服务器端起作用,因此如果应用程序被刷新,选择将消失。然而,我希望删除树存储本身中的选择,并以某种方式刷新视图,以便用户可以立即看到其确认的效果。我一直在遵循nestedList的教程,但我似乎再也找不到了,这段代码基于此: var itemId = ''; Ext.define('MyApp.view.MainView', { exten

我的应用程序中有一个嵌套列表,当用户做出选择时,他们会被带到带有一些选项的detailCard。其中一个选项是确认其选择。确认后,应将所选内容从列表中删除。这在服务器端起作用,因此如果应用程序被刷新,选择将消失。然而,我希望删除树存储本身中的选择,并以某种方式刷新视图,以便用户可以立即看到其确认的效果。我一直在遵循nestedList的教程,但我似乎再也找不到了,这段代码基于此:

var itemId = '';
Ext.define('MyApp.view.MainView',
{
extend: 'Ext.tab.Panel',
xtype: 'main',
alias: "widget.mainview",

requires: [
    'Ext.dataview.NestedList',
    'Ext.data.proxy.JsonP'
],
config:
{
    tabBarPosition: 'bottom',

    items: [
    {
        xtype: 'nestedlist',
        title: 'Listings',
        iconCls: 'home',
        displayField: 'listingValue',
        scrollable: true,

        detailCard:
        {
            xtype: 'panel',
            scrollable: true,
            styleHtmlContent: true,
            items: [
            {
                xtype: 'fieldset',
                readOnly: true,
                title: 'Schedule Information:',
                items: [
                    {
                        name: 'from',
                        id: 'from',
                        xtype: 'textareafield',
                        label: 'From',
                        readOnly: true
                    },
                    {
                        name: 'to',
                        id: 'to',
                        xtype: 'textareafield',
                        label: 'To',
                        readOnly: true
                    },
                    {
                        name: 'moreInfo',
                        id: 'moreinfo',
                        xtype: 'textfield',
                        label: 'More Info',
                        readOnly: true
                    },

                ]
            },
            {
                xtype: 'container',
                flex: 1,
                items: [
                {
                    xtype: 'button',
                    text: 'Confirm',
                    action: 'confirmSelection',
                    margin: '10 5',
                    padding: '5',
                    ui: 'confirm'
                }]
            }]
        },

        listeners:
        {
            itemtap: function (nestedList, list, index,
                element, post)
            {
                var detailCard = this.getDetailCard();
                detailCard.setHtml('');
                itemId = post.get('id');
                Ext.getCmp('from').setValue(post.get(
                    'from'));
                Ext.getCmp('to').setValue(post.get('to'));
                Ext.getCmp('moreinfo').setValue(post.get(
                    'moreinfo'));

            }

        },



        store:
        {
            type: 'tree',

            fields: [
                'id', 'from', 'to', 'fromcity', 'tocity',
                'time', 'address',
                {
                    name: 'leaf',
                    defaultValue: true
                },

                {
                    name: 'listingValue',
                    convert: function (value, record)
                    {

                        listingValue = '$<b>' + record.get(
                            'address') + '</b> ' + record
                            .get('fromcity') + ' to ' +
                            record.get('tocity');

                        return listingValue;
                    }
                }
            ],

            root:
            {
                leaf: false
            },

            proxy:
            {
                type: 'jsonp',
                url: 'http://myURL.com/page.php?action=go',
                reader:
                {
                    type: 'json',
                    rootProperty: 'root'
                }
            }
        }
    },
    {
        title: 'Dashboard',
        iconCls: 'action',

        items: [
            {
                docked: 'top',
                xtype: 'titlebar',
                title: 'Dashboard'
            },

        ]
    }]
   }
});

此时我不知道该怎么办,因为商店是在视图中设置的,我不知道如何在控制器中访问它。我学习了treeStore.removeAll和treeStore.load,但是在没有任何类型的引用名的情况下设置存储时,如何在控制器中调用这些函数呢?有没有办法删除用户的选择并显示视图,或者完全重新加载视图,以便从服务器检索新列表?

因为我的列表位于我的应用程序的第一页,所以我成功地使用window.location.reload;并重新加载整个应用程序。这不是最优雅的解决方案,但这些变化都得到了反映

我不会接受我自己的答案,以防有人提出更好的解决方案