Results 1 to 9 of 9

Thread: Component on the top of ComboBox's list

  1. #1
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    66

    Question Component on the top of ComboBox's list

    Basically i want to insert HtmlContainer to the top of combobox's list same way as paging toolbar on the bottom.
    Everything is the same as paging toolbar except list's onRender method.

    Code:
            list = new LayoutContainer() {
    
                @Override
                protected void doAttachChildren() {
                    super.doAttachChildren();
                    ComponentHelper.doAttach(ComboBox.this.htmlContainer);
    
                }
    
                @Override
                protected void doDetachChildren() {
                    super.doDetachChildren();
                    ComponentHelper.doDetach(ComboBox.this.htmlContainer);
                }
    
                @Override
                protected void onRender(Element parent, int index) {
                    super.onRender(parent, index);
                    eventPreview.getIgnoreList().add(getElement());
    
                    if (htmlContainer != null) {
                        // here
                        // working default =>but on the bottom of list
                        footer = list.el().createChild("<div class='" + listStyle + "-topCont'></div>");
                        htmlContainer.render(footer.dom);
    
                        // working but htmlC is always on the bottom of list
                        //list.el().insertFirst(footer.dom);
                        //htmlContainer.render(footer.dom);
    
                        //footer = list.el().createChild("<div class='" + listStyle + "-topCont'></div>");
                        //htmlContainer.render(footer.dom, 0);
                    }
                }
            };
    thanks for any help.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    What do you want to display inside the htmlcontainer? There is probably a much better way.
    The other way will ways be the bottom, because of the nature how the listview is added and the layoutsystem works.

  3. #3
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    66

    Default

    Quote Originally Posted by sven View Post
    What do you want to display inside the htmlcontainer? There is probably a much better way.
    The other way will ways be the bottom, because of the nature how the listview is added and the layoutsystem works.
    Label and link. Similar to facebook "Messages".
    What is much better way?

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    You can use a custom template to show this informations.

  5. #5
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    66

    Default

    Quote Originally Posted by sven View Post
    You can use a custom template to show this informations.
    How can the template find out if the given record is the first in the list?
    I do not want use fake record.

    thanks

  6. #6
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    This is harder again. That is why i asked for your requirements. Can you please explain in detail what kind of information you want to display there?


    If you want to go the same approach as the paging toolbar, this will not work.

    If you cannot go the template way, than you need to give the layoutcontainer, that holds the listview, a rowlayout and add the htmlcontainer as first component and the listview as second. You probably need to adjust a couple of more methosd than, like resitrct

  7. #7
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    66

    Default

    My template :
    Code:
                    "<tpl for=\".\">" +
                    "<tpl if=\"firstRecord == true\">" +
                    "<div>This is header</div>" +
                    "<div>First data record</div>" +
                    "</tpl>" +
    
                    "<tpl if=\"firstRecord == false\">" +
                    "<div>Next data record</div>" +
                    "</tpl>" +
                    "</tpl>";
    is that wrong way ?

  8. #8
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    Yes that can also work, with the help of the ModelProcessor.

  9. #9
    Ext GWT Premium Member
    Join Date
    Oct 2009
    Posts
    66

    Default

    i solved this by your second advice.
    thanks for your time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •