Thursday, June 30, 2011

Re: Fill a grid from my database

I think what Khadija wants to use is a GXT datagrid,i managed to do so by extending my DTO class with the BeanModelTag interface,
then wrote a function to load the objects i want to display in the grid.....
below is the code for loading the Grid.

private Grid createBidGrid(){

    final GWTServiceAsync service = (GWTServiceAsync)GWT.create(GWTService.class);
    RpcProxy proxy = new RpcProxy()
    {
      @Override
        public void load(Object loadConfig,AsyncCallback callback){
            service.getItems(callback);
      }
    };
    BeanModelReader reader = new BeanModelReader();
    ListLoader loader = new BaseListLoader(proxy, reader);
    ListStore<BeanModel> store = new ListStore(loader);
    loader.load();
    List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
 
        columns.add(new ColumnConfig("supplierName", "Supplier Name", 130));
        columns.add(new ColumnConfig("procRefNo", "Proc Ref No", 130));
        columns.add(new ColumnConfig("procSubject", "Subject", 130));
        columns.add(new ColumnConfig("issueDate", "Issue Date", 130));
        columns.add(new ColumnConfig("procMthName", "Procurement Name", 130));
        columns.add(new ColumnConfig("biddingTypeName", "Bidding Type", 130));
        columns.add(new ColumnConfig("bidMethodName", "Bid Method", 130));
        ColumnModel cm = new ColumnModel(columns);

        Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
        //grid.setAutoExpandColumn("supplierName");
        grid.setColumnLines(true);
        grid.setColumnResize(true);
        grid.setAutoHeight(true);
        grid.setBorders(true);
        return grid;

The getItems() being the above mentioned function.

I am looking to make this a live grid,such that whenever i add an item to the database,it automatically adds it to the GRID

On Wed, Jun 29, 2011 at 8:04 PM, Robert W <riasol.rob@gmail.com> wrote:
GWT 2.4 or gwt-incubator project had something called PagedDataGrid or
similar. In 2.3 gwt is Editor framework suitable for your requirements
too.

On Jun 29, 10:21 am, Khadija FERJANI <ferjani.khad...@gmail.com>
wrote:
> Good morning everybody,
> I wonder if someone could help me to fill my Grid from a database.
> My result have to be like this examplehttp://www.sencha.com/examples/pages/grid/widgetrenderer.html
> Thanks.
>
> --
> Cordialement, Khadija FERJANI
> Élève ingénieur à la faculté des sciences de Tunis.

--
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.




--
Gibson Wasukira
Making Technology a Business Asset



--
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