1. #1
    Ext JS Premium Member
    Join Date
    Apr 2008
    Posts
    47
    Vote Rating
    0
    sarada is on a distinguished road

      0  

    Question Unanswered: Titles or Headers for DualListField "from" and "to" field?

    Unanswered: Titles or Headers for DualListField "from" and "to" field?


    Hi All,

    I am still learning GXT coding. I have a question with DualListField. I see that it can added on a form and label can be provided for the whole field. Is it possible to include a title or header on top of each "from" and "to" List views?

    Thanks,
    Sarada

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    The short answer looks like "no," not easily.

    That said, DualListField wraps two ListView widgets. So anything you can do with ListView widgets you can potentially do here (it would just take some tweaking). Do notice that the ListView objects in DualListField are private and not protected, so any subclassing will need to take this into account.

  3. #3
    Sencha Premium Member
    Join Date
    May 2012
    Posts
    39
    Vote Rating
    2
    hcr is on a distinguished road

      0  

    Default


    Since this was a requirement in my project, I was able to solve this.

    We have subclassed most of sencha's widgets that we use since we need to tweak one thing or another and for this modification I do strongly suggest to encapsulate it.

    So in your subclass of the DualListField you need 3 new methods:

    PHP Code:
        private void setTitles(String pFromTitleString pToTitle) {
            
    HorizontalPanel panel = (HorizontalPanelgetPanel();
            
    VerticalPanel buttonBar = (VerticalPanelgetButtonBar();

            
    panel.remove(getFromView());
            
    panel.remove(getToView());
            
    panel.remove(buttonBar);

            
    ContentPanel cp = new ContentPanel();
            
    cp.setHeadingText(pFromTitle);
            
    cp.add(getFromView());
            
    panel.add(cp);

            
    panel.add(buttonBar);

            
    cp = new ContentPanel();
            
    cp.setHeadingText(pToTitle);
            
    cp.add(getToView());
            
    panel.add(cp);
        }

        private 
    native Object getPanel() /*-{
             return this.@com.sencha.gxt.widget.core.client.form.DualListField::panel;
        }-*/
    ;

        private 
    native Object getButtonBar() /*-{
            return this.@com.sencha.gxt.widget.core.client.form.DualListField::buttonBar;
        }-*/

    And in your constructor you can simply call after the super call

    PHP Code:
            setTitles(pFromTitlepToTitle); 

    Hope this will help future generations... ;-)

    Have fun!
    -hcr-

Thread Participants: 2