jeudi 9 août 2018

While uncheck the checkbox needs to reload the search item

I'm having the search column with checkbox along with folder names. when I click the checkbox of corresponding folder, it will show their items. As well as when I click on multiple checkbox it will show their corresponding items. But when I uncheck the folder, the corresponding items doesn't remove. So I need the hard reload or refresh when I check or uncheck the checkbox or need to clear the cache for every check or uncheck.

Here is my Code:

    Checkbox: Core.component.Checkbox.extend({
        click: function () {
            var ret=null;
            var nav = this.get("controller").get('selectedNavigator');
            ret = this._super.apply(this, arguments);
            var states=null;
            Ember.run.schedule('sync', this, function () {
                Ember.run.schedule('render', this, function () {
                    states = this.get('parentView.itemStates');
                    var values =  Object.keys(states).filter(function (key) {
                        if(states[key]){

                        return states[key];}
                        else{return;}
                    });
                    if (values.length === 0) {
                        Core.Action('core:contentHome', {});
                    } else {
                        this.set('parentView.model.values',values);
                        nav.publish();
                    }
                });
            });
            return ret;
        }
    }),

Please provide me suggestion on this. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire