Home > DeveloperSection > Forums > Sencha Touch 1.1: Setting Panel properties after selecting item in List
lois waisbrooker
lois waisbrooker

Total Post:70

Points:494
Posted on    May-31-2013 1:48 AM

 Sencha Touch Sencha Touch 
Ratings:


 1 Reply(s)
 990  View(s)
Rate this:
Hi Expert! 

I'm using Sencha Touch 1.1. I have a Ext.List and when the user selects an item, I switch to the details page using
rootPanel.setActiveItem('details'); That works fine. Now I want to get the details of the selected item and populate properties in the 'details' panel. How do I do that?

At the moment I'm passing the record around to the various panels of the details page by using this code:

        onItemDisclosure: function (record) {
            // user has selected a Country from the Country List.
            // TODO: There must be a better way to pass the data around
            CountryDetailsToolbar.setTitle(record.data.title);
            var upperData = { upper: record.data.title.toUpperCase()};
            CountryDetailsHeaderLeft.update(upperData);
            CountryDetailsHeaderMonth.update(record.data);
            viewport.setActiveItem('CountryDetailsCarousel');
        }

This seems a bit messy to me. Is there a cleaner way to set titles and update panels with the data "record"?

Thanks in advance! 


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    June-01-2013 12:54 AM

Hi Lois!

You can use rootPanel.getActiveItem() to get instance of currently selected panel, i am not sure about what do you mean by populate properties in the details tab

Update:

I think there isn't any problem in passing record data between panels, i think that is the most efficient way

onItemDisclosure: function (record) {
    // user has selected a Country from the Country List.
    var title = record.get('title');

    CountryDetailsToolbar.setTitle(title);
    CountryDetailsHeaderLeft.update({ upper: title.toUpperCase() });
    CountryDetailsHeaderMonth.update(record.data);

    viewport.setActiveItem('CountryDetailsCarousel');
}

Don't want to miss updates? Please click the below button!

Follow MindStick