Announcement

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

    Velocity Support for CurrentDate in DataSource

    I have a datasource successfully loading (all) records against a SQL Server database. I want to grab only records for today which can be done via a column, 'created_at'. I've been unsuccessful in getting the correct whereClause defined to do that. I'm sure I'm missing something obvious, so apologies up front.

    My datasource is attached as well as the console output in Eclipse. Note, I modified the console output to remove username and password values.

    I'm using SmartGWT Pro 2.3.
    I'm testing my datasource in the adminConsole, in Firefox 3.6.10.
    There are no errors generated.

    Thanks in advance.
    Attached Files

    #2
    You're not passing the operationId in client-side, so your custom fetch isn't being used. You can pass it via ListGrid.setFetchOperation().

    Comment


      #3
      Thanks for the quick reply.

      I modified my client for the fetchOperation(), but now I have an error - a 404 transport error. The adminConsole still pulls all records so (I think) the .ds.xml file is still good.

      For your reference, I've attached the EntryPoint which creates the ListGrid.

      I've reviewed the showcase examples (LGPL and Pro), but I didn't find a ListGrid.setFetchOperation() reference to compare, did I miss it?

      Thanks much.
      Attached Files

      Comment


        #4
        Make use of the JavaDoc.

        A 404 for what resource? Use Firebug's NET panel.

        Comment


          #5
          The 404 is my error, when not getting my data, I tried a fetchData() on the grid. FireBug lists this:

          http://127.0.0.1:8888/userResponsesDS?isc_rpc=1&isc_v=SC_SNAPSHOT-2010-08-03&isc_xhr=1&isc_tnum=0

          So now, I'm at a loss as to my next step. I cannot seem to get data in a ListGrid using my datasource. Oddly enough, the datasource loads all the records when testing from the adminConsole. What would be the difference? because that must be the cause of my error.

          There are no errors on the console, so I'm not sure what to do now to get a ListGrid loaded with my data from my database. Please advise.

          Again, thanks for your time/assistance.

          Comment


            #6
            It looks like you've set a dataURL on a DataSource to point to a custom servlet, but you haven't registered the custom servlet in web.xml, or it's URL is wrong. Just an ordinary servlets issue not related to SmartGWT - let us know if we're missing something here.

            Do note that in the default web.xml shipped with all the sample projects, all the built-in servlets are registered at a path that includes the GWT module name, because that's how GWT sets up the resources when you compile.

            Comment


              #7
              Hmmm, I do not have a dataUrl or custom servlet.

              I've stripped everything back and created a simple test case - a no frills databound ListGrid, which works (yah!) when pulling all the data.

              If I create Criteria and invoke ListGrid.fetchData(Criteria), I successfully filter only the records I want (yah! again).

              If I add an operationBinding to the ds.xml for the same fetch, and then request that data via ListGrid.setFetchOperation(operationId), I see a popup error:

              "The Custom SQL feature is only available with the Power and Enterprise Editions, and you have the Pro Edition. See http://smartclient.com/licensing for details."

              Possible I am not calling the correct methods. My code snippet:
              Code:
                      guidesGrid.setDataSource(DataSource.get("guidesDS"));
                      guidesGrid.setFetchOperation("byPdfId");  // operationId in DS
                      guidesGrid.fetchData();
              If I remove the ListGrid.fetchData(), the license popup error is not displayed, but I do not get any results.

              ds.xml details:
              Code:
                  <operationBindings>
                      <operationBinding operationType="fetch" operationId="byPdfId" >
                          <whereClause><![CDATA[
                              guides.pdf_id > 175
                              ]]>
                          </whereClause>
                      </operationBinding>
                  </operationBindings>
              Two questions, I have the Pro license, are operationBindings defined in the ds.xml supported?

              Second for Criteria, how can you do a more complex filter? For example, id > 175 vs. id = 175? I know there is AdvancedCriteria but that is documented as only available for Power & EE.

              Thanks much.

              Comment


                #8
                Your previous error (404) is still most likely due to a bad dataURL being specified.

                This new error is exactly what the message says - the Advanced Filtering and SQL Templating features of the SQLDataSource are both part of Power edition (as listed as smartclient.com/product and as indicated in JavaDoc and the QuickStart Guide).

                So, options are to upgrade to Power, or to write your own custom DataSource to implement your own server-side advanced filtering.

                Comment

                Working...
                X