HZNM.COM
welcome to my space
X
Search:  
 HOME   Paging within a Grid
Paging within a Grid
Published by: cfz 2009-01-09
Welcome to:hznm.com

  • CodeGuru: Creating a Custom DataGrid Paging Control::
    Create your own custom DataGrid paging control over which you, the developer, will have more control. By mendhak.
    http://www.codeguru.com/vb/vb_internet/aspnet/article.php/c13209
    HOME
    Hi folks,

    is there a way to use a PagingToolbar within a Grid? I am getting my data using a Bean and cannot bind that stuff.

    Thanks!


  • No paging within grids yet ?


  • Thanks Darrell,

    The new paging grid example doesn't seem to make any difference to it. I thought that the example would cover the new BeanModel operation?

    Kind regards

    ACC


  • I added another demo page that uses BeanModel. The only difference in the code is that the service returns beans and the loader uses a ModelBeanReader. Changes are in SVN.


  • Okay, I let myself down in that a class variable 'callback' in my PageTable code was overriding the local callback in the RpcProxy load function. I need to take more heed of the Eclipse IDE warnings. Still working on this darn Paging Bean Grid!

    Also, I notice in the sample code "PagingBeanGridPage.java" that the variable 'Stock' should be replaced by BeanModel (If my understanding is correct).

    Also Darrell, what are your thoughts on the inclusion of 'IsSerializable' into the BasePagingLoadConfig and SortInfo, SortDir classes? My JBoss RPC comms needs it. It shouldn't be an issue to include in the library I would imagine?

    regards

    ACC


  • Thanks for the quick reply!
    I notice that I now get a compile error (after cleaning etc). The previous few svn checkouts have worked well..

    A goof in the checkin or have I done something silly?

    compile:
    [mkdir] Created dir: /root/workspace/com.extjs.gxt/build/bin
    [javac] Compiling 373 source files to /root/workspace/com.extjs.gxt/build/bin
    [javac] /root/workspace/com.extjs.gxt/user/src/com/extjs/gxt/ui/client/widget/grid/GroupingView.java:260: java.lang.Object cannot be dereferenced
    [javac] Element g = XDOM.getElementById(m.get("_groupId").toString());
    [javac] ^
    DataGridCheckboxes::
    Jul 28, 2003 This will maintain the checkbox selection across the paging and sorting of the grid. Other things that can be done would be to hide all the
    http://www.koolsoft.com/DataGridCheckboxes.aspx
    HOME
    [javac] /root/workspace/com.extjs.gxt/user/src/com/extjs/gxt/ui/client/widget/grid/GroupSummary.java:126: java.lang.Object cannot be dereferenced
    [javac] refreshSummaryById(m.get("_groupID").toString());
    [javac] ^
    [javac] /root/workspace/com.extjs.gxt/user/src/com/extjs/gxt/ui/client/widget/grid/GroupSummary.java:133: java.lang.Object cannot be dereferenced
    [javac] refreshSummaryById(model.get("_groupID").toString());
    [javac] ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 3 errors


  • Great stuff! All going.
    Thanks Darrell, excellent work!


  • Try now.


  • I'm using the SVN 1.1 library,
    I'm communicating to a JBoss SEAM server. I've added IsSerializable to
    BasePagingLoadConfig
    SortInfo

    Doing so has enabled the code to work and I have it tested using the new BeanModel (based upon the excellent Blog entry http://extjs.com/blog/2008/07/14/preview-java-bean-support-with-ext-gwt/

    But I'm trying to use it with the Paging Table ..
    BeanModelReader reader = new BeanModelReader();
    final BasePagingLoader loader = new BasePagingLoader(proxy,reader);
    ListStore store = new ListStore(loader);

    The simple grid works, but not the paging table ...
    Any ideas?


  • Revision 685 in the trunk had the compile error...


  • Fix is in SVN.


  • I added a paging grid example to the explorer demo (PagingGridPage). Change is in SVN.


  • Thanks Darrell, very fast response!
    Still nothing working for me in this Paging mechanism...
    I can get non pageload data fine!

    This is pretty much the whole thing for getting it fetched off the JBoss server and displayed in a page grid

    This is the main test class, (I'm not sure why I need to extend BaseModelData when the BeanModelTag is all that is needed for the standard BeanModel Grid). Is this the problem?

    public class WsTest extends BaseModelData implements BeanModelTag,Serializable,IsSerializable {
    private static final long serialVersionUID = 9003110853413414367L;
    private String value;
    protected WsTest() {}

    public WsTest(String value) {
    this.value = value;
    }

    public String getValue() {
    return value;
    }

    public void setValue(String value) {
    this.value = value;
    }
    }

    I have a client webserviceAsync.java file which has this...

    public void getWsTests(PagingLoadConfig config, AsyncCallback callback);

    The client side Webservice :
    public PagingLoadResult getWsTests(PagingLoadConfig config);


    On the server side I have this line in the WebserviceLocal.java
    @WebRemote
    PagingLoadResult getWsTests(final PagingLoadConfig config) ;

    And the implementaion file WebserviceImpl.java (for completeness):
    This routine appears to work fine .

    public PagingLoadResult getWsTests(final PagingLoadConfig config) {
    WsTest w1 = new WsTest("Jenny");
    WsTest w2 = new WsTest("Aly");
    WsTest w3 = new WsTest("Tom");

    List sublist = new ArrayList();

    sublist.add(w1);
    sublist.add(w2);
    sublist.add(w3);

    return new BasePagingLoadResult(sublist, 0, sublist.size());

    }



    The client side code is pretty similar
    to your example ..
    (I've checked that "name" and "description" exist and service is picked up fine)

    RpcProxy proxy = new RpcProxy() {
    @Override
    public void load(Object loadConfig, AsyncCallback callback) {
    service.getWsTests((PagingLoadConfig) loadConfig, callback);
    }
    };

    // loader
    BasePagingLoader loader = new BasePagingLoader(proxy, new BeanModelReader());
    loader.setRemoteSort(true);
    loader.load(0, 50);
    ListStore store = new ListStore(loader);
    final PagingToolBar toolBar = new PagingToolBar(50);
    toolBar.bind(loader);
    List columns = new ArrayList();
    columns.add(new ColumnConfig("value", "Value", 150));
    ColumnModel cm = new ColumnModel(columns);

    Grid grid = new Grid(store, cm);
    grid.setLoadMask(true);
    grid.setBorders(true);
    grid.setAutoExpandColumn("value");

    ContentPanel panel = new ContentPanel();
    panel.setFrame(true);
    panel.setCollapsible(true);
    panel.setAnimCollapse(false);
    panel.setButtonAlign(HorizontalAlignment.CENTER);
    panel.setHeading("Paged Images");
    panel.setLayout(new FitLayout());
    panel.add(grid);
    panel.setSize(600, 350);
    panel.setBottomComponent(toolBar);
    add(panel);


    Now I have had to add "implements IsSerializable" to BasePagingLoadConfig.java, SortInfo.java, and Style.java to make it easy for JBoss to accept the rpc.

    Thanks for your fast responses. I'm really keen to knock this bit over and get paged grids going!

    Sincerely

    ACC


  • Hi Darrell,

    Latest SVN error ... build 517 2.0 API Changes 656
    [javac] /root/workspace/com.extjs.gxt/user/src/com/extjs/gxt/ui/client/widget/form/ComboBox.java:804: java.lang.Object cannot be dereferenced
    [javac] String newValue = m.get(getDisplayField()).toString();

    This blasted page bean grid is driving me crazy. Normal grid beans work. Paged don't.

    I'm using Java 1.5, Linux Ubuntu 2.6.24 Eclipse 3.3
    Could be related to the JBoss side of things. The IsSerializable...

    ACC





  • How much does getting a small tattoo on your hip/stomach hurt?
    Do anyone else have an itchy anus? ?

    You are looking at:hznm.com's Paging within a Grid, click hznm.com to home
     
     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 hznm.com        Site made:CFZ