1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    376
    Vote Rating
    0
    zaccret is on a distinguished road

      0  

    Lightbulb Pure GWT RPC VS Data Loading API

    Pure GWT RPC VS Data Loading API


    Hi,

    I would like to understand better the data loading API. In the case of a combo box, I can build myself the store with a pure GWT RPC, like that :
    Code:
        public void onModuleLoad() {
            Viewport viewport = new Viewport();
    
            final FormPanel panel = new FormPanel();
            panel.setHeading("My panel");
            panel.setWidth(400);
    
            final ComboBox combo = new ComboBox();
            combo.setFieldLabel("File");
    
            final ListStore store = new ListStore();
            final SimentServerServiceAsync serviceExercises = RPCServiceLocator.getExercisesService();
            serviceExercises.getExerciceNames(new AsyncCallback<List<String>>() {
                public void onFailure(Throwable caught) {}
                public void onSuccess(List<String> result) {
                    for (String text : result) {
                        BaseModel model = new BaseModel();
                        model.set(combo.getDisplayField(), text);
                        store.add(model);
                    }
                }
            });
            combo.setStore(store);
            panel.add(combo);
    
            viewport.add(panel);
    
            RootPanel.get().add(viewport);
        }
    If I want to use the Data Loading API (ListStore + RpcProxy + BaseListLoader), then my service has to return a List (or ListLoadResult) of ModelData instead of List<String>.
    The changes :
    - the instantation/setup of the model will be made on the server side instead of client side
    - the code seems to be a little more complex

    In that case, I don't see the benefits of the Data Loading API. Can someone tell me if I'm wrong and in which cases we get the benefits of the API ? Thanks.

  2. #2
    Ext GWT Premium Member gslender's Avatar
    Join Date
    Mar 2008
    Location
    Brisbane, Australia
    Posts
    1,572
    Vote Rating
    4
    gslender is on a distinguished road

      0  

    Default


    Would it depend on your problem?

    Info about data loading here http://extjs.com/learn/Documentationata_Loading kinda suggests that the problem being solved is broad (meaning perhaps size and paging) are the kind of problems solved that raw RPC would not be so easy.

    If you only need simple loading, then yes, I'd guess plain GWT RPC might be more straight forward.

    Its kinda like the argument for OO vs procedural coding - there is no doubt OO requires more keystrokes, but the longer term benefit when code size gets big is often where the value is.

    Perhaps Darrell might have some further insight?

Thread Participants: 1