You found a bug! We've classified it as a bug in our system. We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext Premium Member
    Join Date
    Sep 2009
    Posts
    76
    Vote Rating
    0
    ddanny is on a distinguished road

      0  

    Default [FNR] ColorPalette surprise

    [FNR] ColorPalette surprise


    I have a place in my app, where the user can select different colors. I used a ColorMenu for that, which encapsulates a ColorPalette. I used to set the customer preferred colors like this: menu.getColorPalette().setColors();

    I was setting 30 colors and this used to work with gxt 2.1.2.

    Now, with the new gxt 2.2, it looks like it is not working anymore. Looking at the ColorPalette code, I was surprised to see that the new ColorPalette is hard-coded to use exactly 40 colors displayed in a 5 (rows) * 8 (columns) matrix. See the code below...

    Code:
        Grid grid = new Grid(5, 8);
        grid.getElement().setAttribute("role", "presentation");
        grid.setCellPadding(0);
        grid.setCellSpacing(0);
        int mark = 0;
        for (int i = 0; i < 5; i++) {
          for (int j = 0; j < 8; j++) {
            String c = colors[mark];
            grid.setHTML(i, j, "<a aria-label=" + c + " id=" + XDOM.getUniqueId() + " role=gridcell row=" + i + " col=" + j + " class=\"color-" + c
                + "\"><em role=presentation><span role=presentation style=\"background:#" + c + "\" unselectable=\"on\">&#160;</span></em></a>");
            mark++;
          }
        }
    So I think I have 2 options:
    1. Set exactly 40 colors.
    2. Use the ColorPalette default colors.

    Any other solutions to make the old code still work?

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I will fix the code so also more or less nodes will work without an exception.

Similar Threads

  1. ColorPalette questions
    By ddanny in forum Ext GWT: Discussion
    Replies: 4
    Last Post: 6 Jul 2010, 9:54 AM
  2. Replies: 3
    Last Post: 2 Mar 2010, 11:21 AM
  3. ColorPalette in Grid
    By TAG in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 15 Sep 2009, 5:57 AM
  4. Value of colorpalette
    By Carb0 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 2 Apr 2009, 1:07 AM
  5. IE6/7 (Surprise) toolbar issue
    By sam_mooball in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 12 Dec 2007, 4:28 PM

Thread Participants: 1