1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      1  

    Default Answered: setOnItemDisclosure() will not hide after already being fired

    Answered: setOnItemDisclosure() will not hide after already being fired


    I'm having a problem with a list whose setOnItemDisclosure method does not work properly.

    If the disclosure is set to false initially and I set it to true via .setOnItemDisclosure(true), the disclosure icons show, but if I do setOnItemDisclosure(false) after, they do not hide. The same happens in both my code and when I try it in the console.

    I have a work around by doing:

    Code:
    Ext.DomQuery.select('.picture-list .x-list-item .x-list-disclosure')[0].style['display'] = 'none'
    But I want to avoid doing this as it's not very 'clean'. Has anyone else encountered this issue with lists?

    I'm using Sencha 2.1

  2. List hasn't such functionality. You could add it.
    Code:
    updateOnItemDisclosure: function(newConfig, oldConfig) {
    		if (oldConfig == null) {
    			return;
    		}
    		var items = this.listItems;
    		for (var i = 0, ln = items.length; i < ln; i++) {
    			var dItem = items[i].getDisclosure();
    			newConfig === false ? dItem.hide() : dItem.show();
    		}
    	}

  3. #2
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Vote Rating
    1
    Answers
    2
    A.Tyshchyk is on a distinguished road

      1  

    Default


    List hasn't such functionality. You could add it.
    Code:
    updateOnItemDisclosure: function(newConfig, oldConfig) {
    		if (oldConfig == null) {
    			return;
    		}
    		var items = this.listItems;
    		for (var i = 0, ln = items.length; i < ln; i++) {
    			var dItem = items[i].getDisclosure();
    			newConfig === false ? dItem.hide() : dItem.show();
    		}
    	}

  4. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      0  

    Default


    I get what you are doing in the code but can't seem to work out where the oldConfig and newConfig will come from? Is this supposed to be added as an override to the list class?

    Cheers.

  5. #4
    Sencha User
    Join Date
    May 2012
    Posts
    32
    Vote Rating
    1
    Answers
    2
    A.Tyshchyk is on a distinguished road

      0  

    Default


    update- and apply- methods is automatically generated and will call, if you call set- method.

    You may add this code to extended class from List.

  6. #5
    Sencha User
    Join Date
    Nov 2011
    Location
    England
    Posts
    135
    Vote Rating
    7
    Answers
    11
    george.m is on a distinguished road

      0  

    Default


    Great thanks!

Thread Participants: 1