You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mehdi b <me...@yahoo.com> on 2007/10/24 22:01:52 UTC

How to set focus; Editable Table

Hi All,

I have two questions:

1.How can we set focus on a component for example a text field, specially when the form is shown for the first time?

2. I need a table, which I show my data. There is a column which has an "edit" link for every row, when I clicked on that link, the row goes in edit mode for every cell. I know how to create a table using DefaultDataTable or GridView, but I dont know to make the row editable for that row.

Tnx

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: How to set focus; Editable Table

Posted by James Law <jl...@umich.edu>.
mehdi b wrote:
_________________________________

Hi All,

I have two questions:

1.How can we set focus on a component for example a text field, specially when the form is shown for the first time?

2. I need a table, which I show my data. There is a column which has an "edit" link for every row, when I clicked on that link, the row goes in edit mode for every cell. I know how to create a table using DefaultDataTable or GridView, but I dont know to make the row editable for that row.

________________________________

re: #1, probably need some javascript for that, setting focus by using 
the ID of the object in the DOM?

#2
If you are using datagrid, (and don't want to manually manage a repeater 
object or a listview), then you need to implement AbstractColumn as far 
as I know. I just did this myself:

Code:

/**
 * Override AbstractColumn, such that we can still use data table
 * This column builds a panel, containing an ajax link and modaldialog
 * @author jlaw
 *
 */
public class ModalColumn extends AbstractColumn {

    /**
     *
     */
    private static final long serialVersionUID = 7704930178283305774L;

    public ModalColumn(IModel displayModel) {
        super(displayModel);
    }

    public void populateItem(Item cellItem, String componentId, IModel 
rowModel) {
        cellItem.add(new LinkPanel(cellItem, componentId, rowModel));
    }
    public class LinkPanel extends Panel {

        public LinkPanel(final Item item, final String componentId,
                final IModel model) {
            super(componentId);
            ....

            ....          
             //add your links/label whatever here eg:
          add(new Label("my label"));

        }
    }

Remember you'll need some layout (html file) if you use an inner panel 
like this
eg: ModalColumn$LinkPanel.html if using the default strategy for 
resource location.

--James
> Tnx
>
>  __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org