Tuesday, November 1, 2011

Re: GWT Celltable How to make Non-Editable cell in Editable column

Thanks Ozgur.

public void render(com.google.gwt.cell.client.Cell.Context context,
String value, SafeHtmlBuilder sb) {

if(context.getColumn()==2 && context.getIndex()==0 ){

sb.appendHtmlConstant("<div contentEditable='false'
unselectable='true'></div>"); // This non-editable cell
// This will work in mozila firefox ? <div
contentEditable='false' unselectable='true'></div>
}else{
super.render(context, value, sb);
}

}
It works fine as per my use case. :)

Now problem is when I am performing pagination then next N-1 page's
2nd_column of 1st cell is editable :|
How can I do it as non-editable on pagination ?

On Nov 1, 2:04 pm, ozgur aydinli <ozguraydi...@gmail.com> wrote:
> Hi,
>
> You can create your own cell, in the render method:
>
> public class MyCustomeCell extends EditTextCell {
>
> .......
>
>   public void render(Context context, String data, SafeHtmlBuilder sb)
> {
>     if(context.getIndex()==0)
>       // render your own cell, a div or something... ex: <div>data</
> div>
>     else
>       super.render(context,data, sb);
>   }
>
> .......
>
> }
>
> On Oct 31, 12:38 pm, vaibhav bhalke <bhalke.vaib...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I added EditTextCell(stringTestEditTextCell) to Column(testColumn).
>
> >  EditTextCell editTextCell = new EditTextCell();
> >        Column<Record, String> stringColumn = new Column<Record, String>(
> >                 editTextCell) {
> >             @Override
> >             public String getValue(Record object) {
>
> >                 return object.getValue();
> >             }
> >         };
>
> > All cells in testColumn are editable.
>
> >  I want 1st cell of column such way that  1st cell of column should be
> > Non-Editable.
>
> > --
> > Best Regards,
> > Vaibhav
>
> > <http://about.me/vaibhavbhalke>

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

No comments:

Post a Comment