1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    17
    Vote Rating
    0
    ozkmat is on a distinguished road

      0  

    Default Unanswered: Use Record after onItemDisclosure

    Unanswered: Use Record after onItemDisclosure


    Hello again,
    I have an issue to use the Record after the listener event: onItemDisclosure
    I do as follows, where I call the onItemDisclosure:
    Code:
    this.fireEvent('detailCommand', list, record, index);
    In the Controller-File I commit the record for the new View (DetailView) like this:
    Code:
    var xdetail = this.getDetail();
    xdetail.setRecord(record);
    After that, I can use the RecordData in the DetailView like this:
    Code:
    var city = {
                xtype : 'textfield',
                name : 'City',
                label : 'City',
                labelWidth : '',
                readOnly : true
    };
    But when I want to use the RecordData in another way that with 'textfield' and name: 'NameOfData' I wont get anything.
    I tried it many ways but I just wont get the Data. Right now I'm trying like this:
    Code:
    var content = {
                xtype : 'container',
                data : {},
                tpl : Ext.create('Ext.XTemplate', '<div><b>City</b> {City}</div>')
    };
    When I put the value "City: 'bla'" into the data field, I get the field, but else I only see 'City' in the View. I Tried without the data-block but then I have a blank Page.

    I bet its real beginner stuff, but I dont find anything useful in this Forum or on Google..

    Shouldnt I be able to get the Record Data like this or equal to it:
    Code:
    this.getRecord().get('City')

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is all you are doing is firing an event in the onItemDisclosure function?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    17
    Vote Rating
    0
    ozkmat is on a distinguished road

      0  

    Default


    Well.. I'm not sure what u mean bei 'all I do' so I show u the complete lines that get run through when the Event ist fired:

    In the List-Object the Listener ist defined as following:
    Code:
    listeners : {
                    disclose : {
                        fn : this.onListDisclose,
                        scope : this
                    }
     }
    Where later in the same File its fired like this:
    Code:
    onListDisclose : function(list, record, target, index, evt, options) {
            this.fireEvent('detailCommand', list, record, index);
     },
    and all that happens in the Controller-File is this:
    Code:
    detailCommand : "onDetailCommand",
    aaaaand this:
    Code:
    onDetailCommand : function(list, record, index) {
           var xdetail = this.getDetail();
            xdetail.setRecord(record);
            list.select(index, true, false); //In the same Step I select the Item on which the Even fired
            Ext.Viewport.animateActiveItem(xdetail, { type : 'slide', direction : 'left' },);
    },
    This is all what happends after the Disclosure-Event.

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Why not do everything in the disclose event listener onListDisclose? Why have one event listener fire another event?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    17
    Vote Rating
    0
    ozkmat is on a distinguished road

      0  

    Default


    I had the condition to implement it in MVC-Pattern so everything goes through controller. But shouldnt it work like that too?
    The Data is not lost, when I make a TextField with the name: 'DataName' it contains the right information.
    And wouldnt it be the same Problem when I make everything in the Event?

    It's my first Sencha Touch App so, should I do it without the Controller-File? Or at least the Disclosure-Event without?

  6. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    It should but the disclose event is listenable from the controller.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  7. #7
    Sencha User
    Join Date
    Mar 2012
    Posts
    17
    Vote Rating
    0
    ozkmat is on a distinguished road

      0  

    Default


    So.. what should I do? Build it, that everything happens in the Disclose-Event?! Should it work like that? Or is there another way?

  8. #8
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Just use the disclose event in the controller, you don't need to fire a custom event, it's wasteful.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  9. #9
    Sencha User
    Join Date
    Mar 2012
    Posts
    17
    Vote Rating
    0
    ozkmat is on a distinguished road

      0  

    Default


    You mean, this one is too much:
    Code:
    this.fireEvent('detailCommand', list, record, index);
    ?
    But how do I send the Event to the Controller without it?
    Do i 'grab' the Disclose-Event with "disclose" in the controller? And do I remove the 'fn' and 'scope' part then? Or do I have to give this Event some kind of ID?

    Code:
    listeners : {
                    disclose : {
                        fn : this.onPlatesListDisclose,
                        scope : this
                    }
                }
    Sorry :/ It feels like this all should be obvisous :/

  10. #10
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Listen to the disclose event from the controller
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.