Tuesday, May 29, 2012

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



On Wednesday, November 2, 2011 12:20:51 PM UTC+5:30, vaibhav gwt wrote:
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>
  
When user Clicking on perticular Row of Record error occured solution


private class CustomEditCell extends EditTextCell {
        private boolean click;
      
        public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
       
                   if(Condition)
                        sb.appendHtmlConstant("<div contentEditable='false' unselectable='false' >"+value+"</div>");    
                       
                    }else{
                        super.render(context, value, sb);
                    }
                }
            }   
        }        


public void onBrowserEvent(Context context, Element parent, String value,
                  NativeEvent event, ValueUpdater<String> valueUpdater) {
           
                    if(Condition)
                        click = false;
                     }else{
                         click = true;
                     }
                }
            }
           
             if (click) {
                    super.onBrowserEvent(context, parent, value, event, valueUpdater);
             }
        }
         
        public void setClick(Boolean click) {
                this.click = click;
        }




 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/ihaCFFz5r6wJ.
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