Announcement

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

    #16
    Very good work. I've added the classes to smartgwt-extensions :
    http://code.google.com/p/smartgwt-ex...lient/gwtrpcds

    Unit Tests:
    http://code.google.com/p/smartgwt-ex.../gwtrpcds/test

    Comment


      #17
      smartgwt-extensions

      Hi Nikolas,

      Thank you.
      Could you please replace SimpleGwtRPCDS.java with the latest one ?

      Latest one has:
      - correction to work with any component (suggestion by Isomorphic)
      - added paging functionality example.

      Aleksandras.

      Comment


        #18
        Originally posted by alius
        Could you please replace SimpleGwtRPCDS.java with the latest one ?
        Applied to Rev 14.

        Comment


          #19
          Alius, thank you for your solution, it is working perfectly! Now i want to integrate this with filter and sorting support, i'll let you know.

          I post here a working example of server-side paging support, since your example is client-side based and may be confusing for a newbye (like me :-)
          I created a FetchResult class (generic) to carry all fetch result information from the server call.
          At the moment this includes:
          - the total row count
          - the startrow returned from the server (which will be the same as that requested from the client)
          - the endrow returned from the server (which could be lower than that requested from the client, for example if in the previous call you returned 200 total rows but in the meantime some row was deleted)
          - the actual fetched list

          I post here your classes adapted to support server-side paging, the dto class TestRecord and the class GwtRpcDataSource remain the same as yours

          Bye!
          Bit
          Attached Files
          Last edited by bitblaster; 25 Mar 2009, 01:57.

          Comment


            #20
            So far so good. Every thing works, but now we are facing the filtering feature. I tried to do the following:
            for the grid
            DSRequest dsr = new DSRequest();
            dsr.setAttribute("criteria", listGrid.getCriteria());

            And in my datasource: Criteria criteria = (Criteria)request.getAttributeAsObject("criteria");
            But i am not sure if this issss gona work.
            Is somebody implemented server side filtering. I just need some way to send the filtered column name, filtered value, and filter type.

            By the way i tried the life grid with more than 4k records, and tested it. firebug says that this grid sends 2-3-4 requests on scrolling, and i was evil and scrolled alot i the number of requests has increased to 9.
            FYI: firefox supports 8 simultaneous and it managed them somehow but IE supports only 2. What happen then. And does this overkill the server?

            Comment


              #21
              Originally posted by mnenchev
              So far so good. Every thing works, but now we are facing the filtering feature. I tried to do the following:
              for the grid
              DSRequest dsr = new DSRequest();
              dsr.setAttribute("criteria", listGrid.getCriteria());

              And in my datasource: Criteria criteria = (Criteria)request.getAttributeAsObject("criteria");
              But i am not sure if this issss gona work.
              Is somebody implemented server side filtering. I just need some way to send the filtered column name, filtered value, and filter type.
              Yes i'm facing that problem since yesterday. It is possible to obtain the filters from the DSRequest's "data" object, like this:


              Code:
              	JavaScriptObject dataobj = request.getData();
              	if(dataobj != null) {
              		String[] properties = JSOHelper.getProperties(dataobj);
              		for (String attr : properties) {
              			String val = JSOHelper.getAttribute(dataobj, attr);
              		}
              	}
              For example if you have filtered the field "id=5", you will have only one element in the properties array, "id". If you then call JSOHelper.getAttribute(dataobj, "id") this will return "5".


              The problem is that this is true only if you have ONE filter, if you have 2 filters, for example, the above code is no more valid, as you will have nested properties. For example suppose you filtered on "id=5" AND "name='pippo'".

              In this case the properties array will contain 2 elements:
              - operator: "and"
              - criteria: another array of 2 objects which are the operand of the "and" operator.
              You have so to detect such situations and apply the above code recursively.
              Further you have to create an object (serializable) which will contain this filter structure and that you will pass to the server in the RPC call.

              I'm writing this code and will post when i'm done.

              Comment


                #22
                Maybe it's posiblle to add 1 more "dummy" parameter to the filter that will be always sent?

                Comment


                  #23
                  Hi, guys
                  With the GWT-RPC implementation, is there a way to send update data in batch?

                  I set my grid setAutoSaveEdits(false) and save editing when a button is clicked by calling saveAllEdits(). However, the executeUpdate is stilled called with one modified record each time. I expect I can get an array of updated record, and send them to server once.

                  thanks

                  -jason

                  Comment


                    #24
                    Hi,
                    It is not related with GWT-RPC. I've tested saveAllEdits() myself - it is ListGrid which is initiating inserts/updates and it is doing by row.
                    I think you should ask this question SmartClient team.

                    Aleksandras.

                    Comment


                      #25
                      Various APIs on the ListGrid, such as getEditedRecord(), allow you to collect all the data for saving as a single RPC.

                      Comment


                        #26
                        filters

                        Hi, all any success with adding filters to the life grid, that that are sent to the server?

                        Comment


                          #27
                          @alius:
                          i've problems if i make the grid editable. When i do some editings it throws me a javascript exception
                          Code:
                          Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): ProprietÓ o metodo non supportati dall'oggetto
                           number: -2146827850
                           description: ProprietÓ o metodo non supportati dall'oggetto
                          	at com.smartgwt.client.util.JSOHelper.getAttributeAsDate(Native Method)
                          	at com.smartgwt.client.core.DataClass.getAttributeAsDate(DataClass.java:166)
                          	at it.infracom.prova.client.TestDataSource.copyValues(TestDataSource.java:186)
                          	at it.infracom.prova.client.TestDataSource.executeUpdate(TestDataSource.java:136)
                          	at it.infracom.jwolfgwt.client.GwtRpcDataSource.transformRequest(GwtRpcDataSource.java:107)] in http://localhost:8888/it.infracom.prova.Shell/hosted.html?it_infracom_prova_Shell, line 10
                          where in italian the text "ProprietÓ o metodo non supportati dall'oggetto" means "Object field or method unsupported".

                          it happens when it executes the method
                          private static void copyValues(ListGridRecord from, TestRecord to)

                          exactly when it tries to parse the date:
                          Code:
                          to.setDate(from.getAttributeAsDate("date"));
                          I "sniffed" the call in the developer console, but it seems that the date is correctly set

                          Code:
                          15:48:59.202:TMR9:DEBUG:gridEdit:isc_OID_19:editRowForm created with values: {__ref: com.smartgwt.client.widgets.grid.ListGridRecord@e00095,
                          id: 6,
                          name: "Name 6",
                          date: Mon Mar 30 15:40:08 CEST 2009,
                          _selection_4: true}
                          Any ideas?
                          Thanks!
                          Bit

                          Comment


                            #28
                            Try using firebug, it helps me alot with ajax and gwt requests and responses and js.

                            Comment


                              #29
                              Originally posted by mnenchev
                              Try using firebug, it helps me alot with ajax and gwt requests and responses and js.
                              I tried but i'm unable to debug javascript with Firebug. If i activate the Script section the application doesn't work correctly (and doesn't give me any feedback). As soon as i disable the Script section all works correctly (but i obviously cannot hit any "debugger;" breakpoint i putted in the code (i made some native functions to output custom code useful for debugging).

                              Does someone know how i can overcome this problem?

                              Comment


                                #30
                                Hi bitblaster,

                                Try to use getAttributeAsObject and check in debugger type of the object.
                                If type matches - just cast it into correct type.

                                Aleksandras.

                                Comment

                                Working...
                                X