如何从Ext.ux.slidenavigation.View中删除所有项目 [英] How to remove all items from Ext.ux.slidenavigation.View

查看:73
本文介绍了如何从Ext.ux.slidenavigation.View中删除所有项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我用于幻灯片导航的插件:幻灯片导航,我会想要删除涂漆方法上的所有项目.

So here is the plugin that I'm using for slidenavigation: slidenavigation, and I would like to remove all items on painted method.

似乎项目存储在this.data.items中.但是清除数组并不能解决问题.

It seems that items are stored in this.data.items. However clearing an array doesn't solve an issue.

清除商店也没有.所以这是初始化项目并将其推送到插件的画图方法

CLearing the store didn't as well. So here is the painted method to initialise the items and push them to the plugin


Ext.define("APN.view.FlyoutNavigation", {
    id: "flyoutNavigationPanel",
    extend: 'Ext.ux.slidenavigation.View',
    },
    listeners:
    {
        painted: function() {
            this.store.clear()
            this.store.data.clear()
            this.store.items = []

            var arrItems = [
            .. heaps of items in here
            ]

            this.addItems(arrItems);

        },
    },

在插件addItems方法中:


    addItems: function(items) {
        console.log("data from addItems:")
        console.log(this.store)
        var me = this,
            items = Ext.isArray(items) ? items : [items],
            groups = me.config.groups;

        Ext.each(items, function(item, index) {
            if (!Ext.isDefined(item.index)) {
                item.index = me._indexCount;
                me._indexCount++;
            }
            me.store.add(item);
            console.log("data from addItems after adding:")
            console.log(me.store.data.all.length)
        });
        console.log("data from addItems after adding:")
        console.log(this.store)
    },

推荐答案

尝试使用此功能:

this.store.remove(this.store.getRange());

这应该清除商店.

这篇关于如何从Ext.ux.slidenavigation.View中删除所有项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆