1. #1
    Touch Premium Member
    Join Date
    Jun 2008
    Location
    Germany, Dortmund
    Posts
    249
    Vote Rating
    12
    hschaefer123 will become famous soon enough

      0  

    Default How to bind logic to template Markup

    How to bind logic to template Markup


    I would like to add a button to my panel html.

    Therefore i used the panel template.

    I would like to add a button to ma panel and reference it from designer.
    With the renderTo Property i would have done something like

    tpl: '<div id="myBtn"></div>'
    and then Button.renderTo = 'myBtn'

    but the renderTo property is not available inside Designer!?!

    What is the way of doing this inside Designer, because i would like to control/program the button event logic the designer way.

    Cheers Holger

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,259
    Vote Rating
    121
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Holger -

    In general, renderTo should be used when rendering an Ext component into a non-Ext component or plain old HTML markup.

    You should not be rendering buttons directly into the html of a rendered Ext component. This circumvents Ext's managed layout system and also its memory/garbage collection etc. Similar code to what you've posted above is the source of many memory leaks and slow running code!

    Because we are trying to encourage best practices, we've intentionally omitted this configuration from the property pane. If you really want this type of behavior, you can invoke the render method of each component and specify an id as a string, an htmlelement or an Ext.Element to render to. In general this is not what you want though....

    Is there a specific type of layout that you are trying to achieve that you are unable to do with our layout managers?
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Touch Premium Member
    Join Date
    Jun 2008
    Location
    Germany, Dortmund
    Posts
    249
    Vote Rating
    12
    hschaefer123 will become famous soon enough

      0  

    Default


    Hi Aaron,
    i am currently testing/developing with Sencha Designer 2.

    By designing an ArticleDetails i ran into some gotcha's.
    Designer nicely allows adding buttons with corresponding tap events.

    The work in progress is a navigation view with a store list.
    Selecting a list entry pushes my details panel with selected record set to panel (setRecord).

    The panel works fine using a html tpl for outputting record atrributes.

    Now i want to place an AddToCart Button right inside my markup.
    The idea was to add a button to the panel and reference it a way similar to component DataView.

    Currently i added a button and set top:10 and right:10 to place it on top right,
    but i would like to have a button floating inside my markup.
    Is there any trick to place the button centered at the end of the body markup generated by tpl?

    I know that i could do this with plain programming, but i would like to have an approach,
    that is more controlable from Sencha Designer.

    Any plans to have something similar to component.DataView for Templates in general,
    or do you have any other idea?

    Cheers Holger

Thread Participants: 1