1. #1
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default Sencha Architect 2 problem with config onItemDisclosure

    Sencha Architect 2 problem with config onItemDisclosure


    Hello everyone!
    I have a problem with Ext.dataview.List. His config. onItemDisclosure in sencha architect 2 has only one boolean parameter.
    In the guide has it:
    onItemDisclosure : Boolean/Function/Object3True to display a disclosure icon on each list item. The list will still fire the disclose event, and the event can be stopped before itemtap. By setting this config to a function, the function passed will be called when the disclosure is tapped. Finally you can specify an object with a 'scope' and 'handler' property defined. This will also be bound to the tap event listener and is useful when you want to change the scope of the handler.
    And question:
    How correctly give the method a function, not the bool variable?
    It is only for sancha architect 2.
    Thanks.

  2. #2
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default image for my question

    image for my question


    I added a screen to my question
    Attached Images

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    265
    Vote Rating
    9
    worthlutz is on a distinguished road

      0  

    Default


    You need a controller with a controller action.

    Drag a controller action to your controller and add the component query, event name ("disclosure") and a function.

    This will add something like the following in your generated controller code:
    Code:
    config: {
      control: {
        'list-ref': {
           disclose:  'function_name'
        }
      }
    }
    
    function_name: function () {
      do_something_here();
    }

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,087
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Currently, you cannot configure onItemDisclosure to a function. We're aware of the limitation in Architect when certain configurations take mixed types and we don't provide all of them. In particular we don't have anything that can accept a boolean/number/string AND also accept a function.

    In the interim, you should set onItemDisclosure to true and subscribe to the disclose event.

    worthlutz's response of using a controller action is also a valid way to do this.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default It worked

    It worked


    Thank for you! I done this. All worked.

  6. #6
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default


    Quote Originally Posted by worthlutz View Post
    You need a controller with a controller action.

    Drag a controller action to your controller and add the component query, event name ("disclosure") and a function.

    This will add something like the following in your generated controller code:
    Code:
    config: {
      control: {
        'list-ref': {
           disclose:  'function_name'
        }
      }
    }
    
    function_name: function () {
      do_something_here();
    }
    I have a question. How you added this
    control: {
    'list-ref': {
    disclose: 'function_name'
    }
    }
    in the Sencha architect?

  7. #7
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default About sencha architect

    About sencha architect


    I found the answer!
    It's easy.It should be onthe panelcodeclick"Overrides class"and add theconfig.It looks like this:
    Ext.define('tsvb2.controller.override.playerEdit', {
    requires: 'tsvb2.controller.playerEdit'
    }, function() {
    Ext.override(tsvb2.controller.playerEdit, {
    config: {
    control : {
    '#players_list' : {
    disclose : 'onDiscloseEvent'
    }
    }
    }
    });
    });



  8. #8
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    265
    Vote Rating
    9
    worthlutz is on a distinguished road

      0  

    Default


    Quote Originally Posted by Skynet-tx View Post
    I found the answer!
    It's easy.It should be onthe panelcodeclick"Overrides class"and add theconfig.It looks like this:
    Code:
    Ext.define('tsvb2.controller.override.playerEdit', {
        requires: 'tsvb2.controller.playerEdit'
    }, function() {
        Ext.override(tsvb2.controller.playerEdit, {
            config: {
            control : {
                '#players_list' : {
                    disclose : 'onDiscloseEvent'
                }
            }
        }
        });
    });

    No! You do not need to "override". You missed the part of my answer.
    Drag a controller action to your controller and add the component query, event name ("disclosure") and a function.



    This means adding a "controller action" from the "Behaviors" group(on the left) in the Architect toolbox to your controller in the Project Inspector(on the right).

    Then select the "controller action" in the Project Inspector and change the "config" items(below the project inspector) for that action: targetType, name, controlQuery and fn. I find it easier to do it in that order.

    This will add the proper code to your controller all you have to do is add the body of the function named in fn.

    Worth

  9. #9
    Sencha User Skynet-tx's Avatar
    Join Date
    May 2012
    Location
    Sevastopol, Russia
    Posts
    20
    Vote Rating
    1
    Skynet-tx is on a distinguished road

      0  

    Default


    Thank you for the explanation. I'm very grateful

  10. #10
    Sencha User
    Join Date
    Jun 2012
    Posts
    6
    Vote Rating
    0
    tecnosencha is on a distinguished road

      0  

    Default


    Hi
    Actuallly in SA 2.1.0 b640 setting onItemDisclosure with a function doesn't have paramater so how can retrieve data values from item disclosure?