piskantali
20 Mar 2014, 4:29 AM
Hello everyone. I'm having this problem for couple of days for now and haven't been able to solve it. Here is the problem itself:
I am using GXT version 3.1 Beta. I want to have a button with a tooltip and an icon in a grid cell. Also button's icon depends on the grid's row data object, for example if this object's some boolean field is true this icon must be "active.png", otherwise "some passive.png". I've found a solution by using AbstractCell class, whose "render" method does the job. But the button(in fact html block) which is rendered is built from my custom html template and so isn't quite like the real GXT button. Of course, I'm using some css styles to decorate the button's border, hover, but still, it isn't quite like the real button. Also, in this case the tooltip is included in my custom html template and works well.
So, another way to go is to use ButtonCell class. In the "render" method I'm setting the icon I want to appear using the "setIcon" method, then I set handler for the button using "addSelectHandler" method and after that I call "super.render". Everything works quite well, but the problem is in tooltip. ButtonCell class doesn't have such method to set it's tooltip. So, I have to append some html code manually to the sb(SafeHtmlBuilder). I'm doing this like so:
setIcon(getMyIcon());
addSelectHandler(myHandler);
sb.appendHtmlConstant("<span qtip='Test tooltip'></span>");
super.render(context, null, sb);
sb.appendHtmlConstant("</span>");
After that the tooltip works just fine, but when I click on the produced button's icon, there is no response. Also, if I click on that narrow rectangle shaped space between the button's icon and button's outline, selection works fine ("onSelect" method is called). Clearly, icon isn't able to recognize the click.
Please, help me! Thanks beforehand.
I am using GXT version 3.1 Beta. I want to have a button with a tooltip and an icon in a grid cell. Also button's icon depends on the grid's row data object, for example if this object's some boolean field is true this icon must be "active.png", otherwise "some passive.png". I've found a solution by using AbstractCell class, whose "render" method does the job. But the button(in fact html block) which is rendered is built from my custom html template and so isn't quite like the real GXT button. Of course, I'm using some css styles to decorate the button's border, hover, but still, it isn't quite like the real button. Also, in this case the tooltip is included in my custom html template and works well.
So, another way to go is to use ButtonCell class. In the "render" method I'm setting the icon I want to appear using the "setIcon" method, then I set handler for the button using "addSelectHandler" method and after that I call "super.render". Everything works quite well, but the problem is in tooltip. ButtonCell class doesn't have such method to set it's tooltip. So, I have to append some html code manually to the sb(SafeHtmlBuilder). I'm doing this like so:
setIcon(getMyIcon());
addSelectHandler(myHandler);
sb.appendHtmlConstant("<span qtip='Test tooltip'></span>");
super.render(context, null, sb);
sb.appendHtmlConstant("</span>");
After that the tooltip works just fine, but when I click on the produced button's icon, there is no response. Also, if I click on that narrow rectangle shaped space between the button's icon and button's outline, selection works fine ("onSelect" method is called). Clearly, icon isn't able to recognize the click.
Please, help me! Thanks beforehand.