I rewrote your code. Basically, I put at the end this two lines;
>>        store.load();
>>        notesTable.getView().refresh();


The finall code:

public void loadTable(){
        GridView view = new GridView();
        view.setForceFit(true);
        //view.setAutoFill(true);
        notesTable.setView(view);

        RecordDef recordDef = new RecordDef(
            new FieldDef[]{
                new DateFieldDef("created"),
                new StringFieldDef("description"),
                new StringFieldDef("author")
            }
        );

        MemoryProxy proxy = new MemoryProxy(getNotesData());
        ArrayReader reader = new ArrayReader(recordDef);
        Store store = new Store(proxy, reader);
        notesTable.setStore(store);

        ColumnConfig configDate = new ColumnConfig("Creado",
"created", 100,
true);
        configDate.setRenderer(new Renderer() {
               public final String render(Object value, CellMetadata
cellMetadata,
                       Record record, int rowIndex, int colNum, Store
store)
{
                   return format.format((Date) value);
               }
           });
        ColumnConfig[] columns = new ColumnConfig[]{
            configDate,
            new ColumnConfig("Descripcion", "description", 350, true),
            new ColumnConfig("Autor", "author", 150, true)
        };
        ColumnModel columnModel = new ColumnModel(columns);

        notesTable.setColumnModel(columnModel);
        notesTable.setStripeRows(true);
        notesTable.setWidth(700);

        this.add(notesTable);
        this.doLayout();

//The lines:
        store.load();
        notesTable.getView().refresh(true);

    }


I hope it works!!



On Oct 30, 1:04 pm, piltrafeta <[EMAIL PROTECTED]> wrote:
> Leo, i've tried now but it's not working.. and moreover i'm having an error
> "*this.grid is null or not an object*"
>
> so if i remove the grid.getView().refresh(true); here is my code:
>
> public void loadTable(){
>         GridView view = new GridView();
>         view.setForceFit(true);
>         //view.setAutoFill(true);
>         notesTable.setView(view);
>
>         RecordDef recordDef = new RecordDef(
>             new FieldDef[]{
>                 new DateFieldDef("created"),
>                 new StringFieldDef("description"),
>                 new StringFieldDef("author")
>             }
>         );
>
>         MemoryProxy proxy = new MemoryProxy(getNotesData());
>         ArrayReader reader = new ArrayReader(recordDef);
>         Store store = new Store(proxy, reader);
>         store.load();
>         notesTable.setStore(store);
>
>         ColumnConfig configDate = new ColumnConfig("Creado", "created", 100,
> true);
>         configDate.setRenderer(new Renderer() {
>                public final String render(Object value, CellMetadata
> cellMetadata,
>                        Record record, int rowIndex, int colNum, Store store)
> {
>                    return format.format((Date) value);
>                }
>            });
>         ColumnConfig[] columns = new ColumnConfig[]{
>             configDate,
>             new ColumnConfig("Descripcion", "description", 350, true),
>             new ColumnConfig("Autor", "author", 150, true)
>         };
>         ColumnModel columnModel = new ColumnModel(columns);
>
>         notesTable.setColumnModel(columnModel);
>         notesTable.setStripeRows(true);
>         notesTable.setWidth(700);
>
>         this.add(notesTable);
>         this.doLayout();
>     }
>
> thanks for your help!!
> Eli
>
> On Thu, Oct 30, 2008 at 12:32 PM, leo_BsAs <[EMAIL PROTECTED]> wrote:
>
> > Perhaps you should try, after set the width of the table...
>
> > grid.getView().refresh(true);
>
> > See...
>
> >http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/Grid...)<http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/Grid...>
>
> > Let me know if it works...
>
> > Leo
>
> > On Oct 30, 9:55 am, piltrafeta <[EMAIL PROTECTED]> wrote:
> > > by the way, i'm using gwt 1.5.3 and gwtext-2.0.5
>
> > > On Thu, Oct 30, 2008 at 10:04 AM, piltrafeta <[EMAIL PROTECTED]>
> > wrote:
> > > > it's semms that if you set the width for the table, the headers dont
> > > > understand it...
>
> > > > On Thu, Oct 30, 2008 at 10:02 AM, piltrafeta <[EMAIL PROTECTED]>
> > wrote:
>
> > > >> Thank you!
> > > >> It works better if i don't set the width for the grid. But if i set
> > the
> > > >> grid size i'm having the same problem.. any other ideas?
>
> > > >> Regards,
> > > >> Eli
>
> > > >> On Thu, Oct 30, 2008 at 9:42 AM, leo_BsAs <[EMAIL PROTECTED]> wrote:
>
> > > >>> Hi, you can use it as:
> > > >>>       GridView view = new GridView();
> > > >>>        view.setForceFit(true);
> > > >>>        grid.setView(view);
>
> > > >>> Regards,
>
> > > >>> Leo
>
> > > >>> On Oct 30, 8:07 am, piltrafeta <[EMAIL PROTECTED]> wrote:
> > > >>> > the thing is that i'm using GridPanel, and the methods you tell me
> > are
> > > >>> > for GridView..
>
> > > >>> > On Oct 29, 5:58 pm, leo_BsAs <[EMAIL PROTECTED]> wrote:
>
> > > >>> > > Perhaps what you want is the "autoFill" feature from the GridView
> > > >>> > > class (
>
> >http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/Grid...))<http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/Grid...>
> > .<http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/Grid...
> > .>
> > > >>> ..
>
> > > >>> > > " setAutoFill(boolean autoFill)
> > > >>> > >           True to auto expand thecolumnsto fit thegridwhen
> > thegridis
> > > >>> created.
> > > >>> > > "
>
> > > >>> > > or the "forceFit"...
> > > >>> > > (
> >http://www.gwt-ext.com/docs/2.0.4/com/gwtext/client/widgets/grid/
> > > >>> > > GridView.html#setForceFit(boolean))
>
> > > >>> > > " public void setForceFit(boolean forceFit)
> > > >>> > >    True to auto expand/contract the size of thecolumnsto fit
> > > >>> thegridwidth and prevent horizontal scrolling.
> > > >>> > > "
>
> > > >>> > > I hope it helps you...
>
> > > >>> > > Leo
>
> > > >>> > > On Oct 29, 3:50 pm, piltrafeta <[EMAIL PROTECTED]> wrote:
>
> > > >>> > > > Hello,
> > > >>> > > > i'm trying to create a simplegridarray but i'm having a
> > problem.
> > > >>> > > > I have a bigcolumnsheaderson the right and on the left of my
> > > >>> > > > definedcolumnsheaders...
> > > >>> > > > So if i set the width for mygridi dont see thecolumnsheaders,
> > but
> > > >>> > > > if i don't set the width i'm having a biggridwidth my data
> > centered
> > > >>> > > > on the middle.
>
> > > >>> > > > Here is my code :
>
> > > >>> > > > RecordDef recordDef = new RecordDef(
> > > >>> > > > new FieldDef[]{
> > > >>> > > > new DateFieldDef("created","d/m/Y"),
> > > >>> > > > new StringFieldDef("description"),
> > > >>> > > > new StringFieldDef("author")}
>
> > > >>> > > > );
>
> > > >>> > > > MemoryProxy proxy = new MemoryProxy(getNotesData());
> > > >>> > > > ArrayReader reader = new ArrayReader(recordDef);
> > > >>> > > > Store store = new Store(proxy, reader);
> > > >>> > > > store.load();
> > > >>> > > > notesTable.setStore(store);
>
> > > >>> > > > ColumnConfig[]columns= new ColumnConfig[]{
> > > >>> > > > new ColumnConfig("Creado", "created", 100, true),
> > > >>> > > > new ColumnConfig("Descripción", "description", 300, true, null,
> > > >>> > > > "description"),
> > > >>> > > > new ColumnConfig("Autor", "author", 200, true)
>
> > > >>> > > > };
>
> > > >>> > > > ColumnModel columnModel = new ColumnModel(columns);
> > > >>> > > > notesTable.setColumnModel(columnModel);
> > > >>> > > > notesTable.setAutoExpandColumn("description");
> > > >>> > > > //notesTable.setWidth(600);
> > > >>> > > > //notesTable.setAutoWidth(true);
> > > >>> > > > //notesTable.setHeight(250);
>
> > > >>> > > > panel.add(notesTable);
>
> > > >>> > > > Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" 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/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to