>From the CellTableExample in the API:

http://google-web-toolkit.googlecode.com/svn/javadoc/latest/index.html?overview-summary.html

 I customized it slightly to implement tab order.
However, tabbing  does not work because table.redraw in
nameColumn.setFieldUpdater steals focus away. If I don't edit the
field and just click on the
TextInputCell, tabbing works. If i comment out
the table.redraw, tabbing works after I have edited a field but my
other fields don't update.

After editing a field , a change event is fired in onBrowser method.
This eventually calls finishediting which then calls the update
method
in the column.fieldUpdater. In the update method is where the
table.redraw is located

I have also tried keeping my list of objects in the ListDataProvider
and calling ListDataProvider.refresh but I have the same issue.
Question) How can I implement tab order and allow tabbing after
editing but still be able to refresh the Celltable grid. I need to
redraw/ refresh the grid because after tabbing I need to update data
in the other columns.

The customization that i needed to do was :
1) Extend TextInputCell and override render methods so that I can set
a tabindex by customizing  template.input
(see below code)
2) In CellTableExample, I disabled KeyboardSelectionPolicy
table.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);

==============  inheriting TextInputCell
=======================================

public class EditableTextCell extends TextInputCell {
         private static final Logger logger =
Logger.getLogger(EditableTextCell.class.getName());
  private SimpleTemplate template;
        protected SafeHtmlRenderer<String> renderer;
        private boolean inline;
    interface SimpleTemplate extends SafeHtmlTemplates {
                @Template("<input value=\"{0}\" tabindex=\"{1}\"></
input>")
                SafeHtml input( String value,int tabindex);
        }
    public EditableTextCell(EventBus eventBus,
                        SafeHtmlRenderer<String> renderer, boolean
inline) {
        super(renderer);
        this.renderer = renderer;
                template = GWT.create(SimpleTemplate.class);
        }
        public EditableTextCell() {
        }
        @Override
        public void render(Context context, String value,
SafeHtmlBuilder sb)
{
                Contact key = (Contact) context
                                .getKey();
                String name = key.getName();
                // Get the view data.
                ViewData viewData = getViewData(key);
                if (viewData != null &&
viewData.getCurrentValue().equals(value)) {
                        clearViewData(key);
                        viewData = null;
                }
                String s = (viewData != null) ?
viewData.getCurrentValue() : value;
                if (s != null   ) {
                        String style = "";
                        SafeHtml html = renderer.render(s);
                        // Note: template will not treat SafeHtml
specially
                        sb.append(template.input( html.asString(),
                                        key.getId() ));
                } else {
                        sb.appendHtmlConstant("<input type=\"text\"
tabindex=\"-1\"></
input>");
                }
        }
        @Override
        public void onBrowserEvent(Context context, Element parent,
String
value,
                      NativeEvent event, ValueUpdater<String>
valueUpdater){
            String eventType = event.getType();
                logger.fine("onBrowserEvent...   " + eventType);
            super.onBrowserEvent(context,parent, value,  event,
valueUpdater);
        }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to