开发者

GWT Celltable and TABbing

So i have a GWT cellTable with various inputs, includ开发者_开发问答ing selectboxes, EditTextCells and some links. I would like TAB to go along each cell.

However, currently i can only get the TAB switching to go between the selectboxes(when KeyboardSelectionPolicy.DISABLED). (ie from here). But it doesnt tab to the EditTextCells or other cells.

(potentially relatedly, EditText <input>s seem like they cannot have their tabindex!=-1, or else i see the cellTable throwing errors. (and it seems to warn in EditText that you shouldnt do this).

is there another tabIndex for EditText or other generic cells that I'm missing maybe? One guy here seemed like he couldnt get it to work and opt'd out.

But according to this issue at googleCode, other people are doing this successfully.


ok so adding the tabIndex does work. for editTextCell I added a new Template for the (normally just safehtml-rendered) text like this:

interface TemplateBasic extends SafeHtmlTemplates {
        @Template("<Label tabindex=\"{1}\">{0}</Label>")
        SafeHtml input(String value, String index);
      }

and then later in render when it sets ...

else if (value != null) {
      SafeHtml html = renderer.render(value);
      sb.append(html) );
}

instead i used

else if (value != null) {
      SafeHtml html = renderer.render(value);
      sb.append(templatebasic.input(html.asString(), Integer.toString( context.getIndex() )) );
    }

this should work for the checkboxcell too; overriding the renderer not to use the static defined INPUT_CHECKED/UNCHECKED with the tabIndex=-1

but im still thinking/hoping there might be a better way....


You can create a new Cell. Or, you can add some script to the CellTable to handle TABs and SHIFT+TABs.

Extend CellTable to achieve this by adding a tab handler would work for your needs. See this link.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜