Announcement

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

    criteria is not null but jsObj is null

    Hi,

    Context: on a datasource, I am checking the request for a criteria to filter on field "id". If no filter given, I just fetch everything.


    executeFetch(String requestId, DSRequest request, DSResponse response)

    I was trying a simple request.getCriteria().getAttribute("id");
    but this gives me a nullpointer somewhere.
    This happens in the case when no filter is given, and therefore no criteria has been given (any).

    After some searching I found this to be true:
    request.getCriteria() != null
    request.getCriteria().getJsObj() == null

    Code:
    [DEBUG] Uncaught exception
    com.google.gwt.core.client.JavaScriptException:
    (TypeError): 'null' is null or not an object
     number: -2146823281
     description: 'null' is null or not an object
        at com.smartgwt.client.util.JSOHelper.getAttribute(Native Method)
        at com.smartgwt.client.core.DataClass.getAttribute(DataClass.java:51)
    Can someone explain why the Criteria is not null, but its javaScriptObject is?
    Or do I have to live with it and always check (in java) the javaScriptObject and not the java object?

    #2
    I checked in a change to that null is returned when getCriteria() is called and there is no filter criteria.

    Sanjiv

    Comment


      #3
      Great, thanks Sanjiv.

      Comment

      Working...
      X