Badge and UI

  1. #1

    Badge and UI

    Hi,

    I'm using Badge plugin to decorate a dinamically created set of buttons.
    They look very nice, however when I scroll the page or collapse the container where buttons are, badge text stays in its place and remain visible.

    What I'm doing wrong?


    Before colapse:


    After colapse:



    Here is my code:

    private Ext.Net.Button CrearBoton(string id, string texto, object icon, bool habilitado, bool standout, string comando, string idsender, int badge=0, string idGrupoParent = "")
            {
                Ext.Net.Button boton = new Ext.Net.Button(texto)
                    {
                        ID = id,
                        Disabled = !habilitado,
                        StandOut = standout
                    };
    
                if (badge > 0)
                    boton.Plugins.Add(new Badge() { Text = badge.ToString() });
    
                if (icon != null)
                    if (icon is Ext.Net.Icon)
                        boton.Icon = (Ext.Net.Icon)icon;
    
                // Agregar el evento de comando
                if (comando != "")
                    boton.Listeners.Click.Handler = "App.direct.Comando('" + comando + "', '" + idsender + "', '" + id + "', '" + idGrupoParent + "');";
    
                return boton;
            }
    Attached Thumbnails Click image for larger version. 

Name:	BadgeBeforeColapse.png 
Views:	51 
Size:	46.5 KB 
ID:	12391   Click image for larger version. 

Name:	BadgeAfterColapse.png 
Views:	57 
Size:	43.7 KB 
ID:	12401  
    Last edited by geoffrey.mcgill; Jun 10, 2014 at 5:12 AM.
  2. #2
    Hi @claudioalfonso,

    Welcome to the Ext.NET forums!

    Please start a new forum thread for your question, with a full (but simplified as much as you can) test case to reproduce the problem.

    If you think the threads are related, please feel free to cross-link between the both.
  3. #3
    I've moved this question to a new thread.
    Geoffrey McGill
    Founder
  4. #4
    Hi !
    I think yuo should just add RenderToBody = false; : it is explainedd here :
    If Badge's component is located inside hidden area (or will be located) then it is required to set RenderToBody="false" for Badge because Badge doesn't track visibility of parent elements
    https://examples2.ext.net/#/MessageB...den_Container/

    so maybe you should just try:
    ...
                if (badge > 0)
                    boton.Plugins.Add(new Badge() { Text = badge.ToString() , RenderToBody=False});
    ...
    I did not try, but i had this problem myself and if i remember ok, this is the way i fixed it !
    Have a nice day
  5. #5
    Hi!,

    Thanks for your reply.

    I've tested your suggestion, it seems to work very nice, badge moves with its container, also it hides when panel hides.
    However, badge appears to be cuted off, inside button.

    Click image for larger version. 

Name:	BadgeRenderToBody_False.png 
Views:	29 
Size:	19.0 KB 
ID:	12591


    Observation: this button is inside a toolbar. So maybe the badge is cutted of because of the toolbar height...


    Quote Originally Posted by brunweb View Post
    Hi !
    I think yuo should just add RenderToBody = false; : it is explainedd here :

    https://examples2.ext.net/#/MessageB...den_Container/

    so maybe you should just try:
    ...
                if (badge > 0)
                    boton.Plugins.Add(new Badge() { Text = badge.ToString() , RenderToBody=False});
    ...
    I did not try, but i had this problem myself and if i remember ok, this is the way i fixed it !
    Have a nice day
    Last edited by claudioalfonso; Jun 11, 2014 at 3:06 PM.
  6. #6
    Please try to add this for the Badge.
    <CustomConfig>
        <ext:ConfigItem Name="getRenderTo" Value="function() { return this.targetEl.parent().parent(); }" Mode="Raw" />
    </CustomConfig>
    If it doesn't help, please provide a test case.

Similar Threads

  1. [CLOSED] Badge Issue on Tab
    By CanopiusApplications in forum 2.x Legacy Premium Help
    Replies: 14
    Last Post: May 22, 2014, 4:30 AM
  2. Badge on DataView Items
    By inteligencija in forum 2.x Help
    Replies: 0
    Last Post: May 12, 2014, 7:16 AM
  3. TabPanel : Badge and UI
    By brunweb in forum 2.x Help
    Replies: 2
    Last Post: Mar 14, 2014, 11:07 AM
  4. [CLOSED] Setting Badge from server
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 23, 2014, 2:52 AM

Posting Permissions