Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    default request properties on ListGrids

    Hi Isomorphic,

    1.

    I wonder if there is an option for ListGrids to have default request properties in the same manner as it has for criteria with
    Code:
     [TABLE="border: 0, cellpadding: 3, cellspacing: 0"]
    [TR="class: cke_show_border"]
    [TD][URL="https://forums.smartclient.com/../../../../com/smartgwt/client/widgets/grid/ListGrid.html#setImplicitCriteria-com.smartgwt.client.data.Criteria-"]setImplicitCriteria[/URL]([URL="https://forums.smartclient.com/../../../../com/smartgwt/client/data/Criteria.html"]Criteria[/URL] implicitCriteria)[/TD]
     		[/TR]
    [/TABLE]
    We have a ListGrid with setAutoFetchData(false). At the point in the code of "fetchData" we use:
    Code:
    [URL="https://forums.smartclient.com/../../../com/smartgwt/client/widgets/DataBoundComponent.html#fetchData-com.smartgwt.client.data.Criteria-com.smartgwt.client.data.DSCallback-com.smartgwt.client.data.DSRequest-"]fetchData[/URL]([URL="https://forums.smartclient.com/../../../com/smartgwt/client/data/Criteria.html"]Criteria[/URL] criteria, [URL="https://forums.smartclient.com/../../../com/smartgwt/client/data/DSCallback.html"]DSCallback[/URL] callback, [URL="https://forums.smartclient.com/../../../com/smartgwt/client/data/DSRequest.html"]DSRequest[/URL] requestProperties)
    where we pass:
    Code:
        new DSRequest() {
                {
                    setOutputs(outputs);
                }
            };
    as "requestProperties"


    I'm aware, that I can declare outputs on the operationBinding, but if I do that for every single grid in our application, there would be a lot of operationBindings. So rather than declaring outputs in the .ds.xml of the datasource, I would like to declare it once in the constructor of the Grid, so that it is applied on every fetch for that ListGrid (like it is possible for criterias with setImplicitCriteria) something like "setImplicitRequestProperties".
    Everywhere I trigger a fetch-operation on the Grid, I have to pass the requestProperties again, for example, we also use filtering on the Grid so to get the outputs I want, I have to interrupt the FilterEditorSubmitEvent like this:

    Code:
    addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
    
                @Override
                public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
                    event.cancel();
                    filterData(getFilterEditorCriteria(), null, getNewOutputsRequest());
                }
            });
    We also use refresh on our Grids that just calls fetchData() on the desired ListGrid. What causes to fetch without outputs. I handled that now with an interface that checks for defaultRequestProperties, but anyway, it would be very helpful and less code to have something like that setImplicitCriteria for requestProperties.
    So, is there a method that handles requestProperties for default, and if not, can it be implemented?

    2.

    Another thing that I noticed is, that if you pass a invalid column name into setOutputs within the requestProperties, it just returns all columns, without raising a notification. Please see this case:

    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.layout.VStack;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class BuiltInDS implements EntryPoint {
        private ListGrid boundGrid;
    
        /**
         * This is the entry point method.
         */
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            VStack vStack = new VStack();
            vStack.setLeft(175);
            vStack.setTop(75);
            vStack.setHeight(500);
            vStack.setWidth("70%");
            vStack.setMembersMargin(20);
            boundGrid = new ListGrid() {
                {
                    setDataSource("animals");
                    setAutoFetchData(false);
                }
            };
    
            boundGrid.setWidth100();
            boundGrid.setHeight100();
    
            HLayout h = new HLayout();
            h.setHeight100();
            vStack.addMember(boundGrid);
    
            boundGrid.fetchData(null, null, new DSRequest() {
                {
                    setOutputs("commonName, scientificName, lifeSpan, status, wrongColumnName");
                }
            });
            vStack.draw();
        }
    
    }
    where animals is unchanged.

    A notification, warning etc. would be highly appreciated instead of just outputting all columns. Or even just giving those columns back that it can identify would be good as well.

    Thanks in advance,

    Kind Regards



    #2
    You can set requestProperties via dataProperties.

    We'll check on the second report.

    Comment


      #3
      Hi Isomorphic,

      do you have an update on the 2nd report?

      Best regards
      Blama

      Comment


        #4
        No. It's assigned, but it's very low priority, so hasn't made it to the top of the queue yet.

        Comment

        Working...
        X