SENCHA TOUCH 1.1: SETTING PANEL PROPERTIES AFTER SELECTING ITEM IN LIST

lois waisbrooker

Total Post:70

Points:494
Posted by  lois waisbrooker
 1276  View(s)
Ratings:
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! 
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Sencha Touch 1.1: Setting Panel properties after selecting item in List

    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');
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!