Announcement

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

    ListGrid dynamic include

    SmartGWT 3.0
    GWT 2.4
    Firefox 6.0

    I followed the Dynamic Include example but I seem to be missing something. Any help would be appreciated. Below is an example of my scenario.

    Code:
    final ListGrid manifestDetails = new ListGrid();
    manifestDetails.setDataSource(manifestDS);
    manifestDetails.setWidth100();  
    manifestDetails.setMargin(25);
    manifestDetails.setCanEdit(false);
    manifestDetails.setAlternateRecordStyles(true);
    manifestDetails.setAutoFetchData(true);
    
    ListGridField country = new ListGridField();  
    country.setAttribute("includeFrom", "Employees.CountryOfCitizenship");
    country.setAlign(Alignment.CENTER);
    country.setWrap(true);
            
    ListGridField passNum = new ListGridField();  
    passNum.setAttribute("includeFrom", "Employees.PassportNumber"); 
    passNum.setAlign(Alignment.CENTER);
    passNum.setWrap(true);
            
    ListGridField passExp = new ListGridField();  
    passExp.setAttribute("includeFrom", "Employees.PassportExpiration");
    passExp.setAlign(Alignment.CENTER);
    passExp.setWrap(true);
    
    manifestDetails.setFields(country, passNum, passExp);
    Here are my datasources....

    manifest.ds.xml
    Code:
    <DataSource ID="Manifest" dbName="manifest"	
    serverType="sql" tableName="manifest">
    	<fields>
    		<field name="ManifestId" type="sequence" primaryKey="true" hidden="true" />
    		<field name="EmployeeId" type="integer" hidden="true" foreignKey="employees.EmployeeId" />
    		<field name="ProjectId" type="integer" hidden="true" foreignKey="projects.ProjectId" />
    		<field name="EmployeeName" title="Name" type="text"/>
    		<field name="Position" title="Position" type="text" />
    		<field name="DateOfBirth" title="DOB" type="date" />
    		<field name="EmbarkDate" title="Embark Date" type="date" />
    		<field name="DisembarkDate" title="Disembark Date" type="date" />
    		<field name="CompanyId" title="Company Id" type="sequence" foeignKey="companies.CompanyId" />
    	</fields>

    Here is my Employees.ds.xml file....
    Code:
    <DataSource ID="Employees" dbName="manifest"
    	serverType="sql" tableName="employees">
    	<fields>
    		<field name="EmployeeId" type="sequence" primaryKey="true" hidden="true" />
    		<field name="PrimaryEmail" title="Contact Email" type="text" length="100" />
    		<field name="PassportNumber" title="Passport #" type="text" length="64" />
    		<field name="PassportExpiration" title="Passport Expiration (MM/DD/YYYY)" type="date" />
    		<field name="SubContractorName" title="Subcontractor Company Name" type="text" length="64" />
    		<field name="CountryOfCitizenship" title="Country of Citizenship" type="text" foreignKey="countries.iso" />
    		<field name="CompanyId" title="Company" type="integer" foreignKey="companies.CompanyId" />
    	</fields>
    And finally the message that I am getting is the following:
    === 2011-12-21 13:09:02,443 [80-7] WARN DSRequest - In outputs, definition 'Pas
    sportNumber' refers to a related DataSource ('Employees') that is not related to
    this dataSource ('Manifest'). You can only specify fields in related DataSource
    s where a foreignKey property establishes the relation from this dataSource ('Ma
    nifest') to the related DataSource. Ignoring this outputs entry.

    === 2011-12-21 13:09:02,446 [80-7] WARN DSRequest - In outputs, definition 'Pas
    sportExpiration' refers to a related DataSource ('Employees') that is not relate
    d to this dataSource ('Manifest'). You can only specify fields in related DataSo
    urces where a foreignKey property establishes the relation from this dataSource
    ('Manifest') to the related DataSource. Ignoring this outputs entry.


    I thought that I had already related the datasources by having the field "EmployeeId" in Manifest.ds.xml show have the foreignKey attribute pointing to "employees.EmployeeId".

    What am I missing?

    #2
    DataSource IDs are case sensitive and you have "Employees" as the ID but "employees" in the foreignKey declaration.

    Comment


      #3
      Yeah that worked thanks!

      However on to my next issue that I am encountering with Dynamic Includes...

      I am able to see both my Manifest fields that I have in the ListGrid as well as the Dynamic Include fields that I have in the ListGrid, all with their proper values.

      However, when I try to export the ListGrid to an excel file, I only get the fields that were part of the Manifest.ds.xml file and none of my dynamic include fields.

      Is there a way to get all fields, i.e. fields from Manifest.ds.xml as well as dynamic include fields, to export to excel?

      Comment


        #4
        We'll check on this. You should be able to achieve the export successfully via manually setting dsRequest.outputs however.

        Comment


          #5
          Alright, I will also look into using dsRequest.outputs for the time being, while awaiting your finding.

          I would also like to add one additional comment that I have encountered while using this dynamic include feature.

          The ListGrid mentioned below is within a Window that has a width/height of 900/400 respectively.

          The Manifest datasource contains approximately 150 records, so given the amount, not all records are displayed at once and a scroll bar is shown on the ListGrid.

          And in case it helps, the Employees datasource has approximately 2000 records.

          If I were to scroll down one click at a time on the ListGrid, I eventually get to the end of the list with no issues.

          However, if I were to grab the scroll bar and instantly drag it to the end of the list, I get an recurring pop-up stating "Finding Records that match your criteria. Never stopping and never showing any more data on the grid.

          How can this be avoided, because I have numerous other ListGrid with scroll bars and no other Grid does this? And to my knowledge the only difference aside from the datasource the records are being pulled from, is that this Grid is using dynamic includes and the others are not.

          Any guidance would be appreciated.

          Comment


            #6
            Have you added any logic of your own that manipulates the requests and responses, especially with respect to startRow/endRow? Are you making any calls to invalidateCache() anywhere? Either of these could be the problem.

            If not, when you get into this state, can you show a few samples of the looping requests and responses from the RPC tab of the Developer Console? Or, similarly, of the Developer Console output when the "ResultSet" log is enabled.

            Comment


              #7
              No, I have not added any logic of my own that manipulates the requests/responses, or anything with respect to startRow/endRow.

              I do have a button that when pressed calls invalidateCache(), but it is not possible to click this button for the following reason.........

              I have a button that says "Export detailed manifest"
              When that button is clicked I have a Windows come up that greys out the background by using setIsModal(true) as well as setShowModalMask(true)

              Within this window I have an export button, a close button, and the ListGrid that is currently being discussed here.

              When I scroll to the end of the ListGrid the recurring message appears on my console.......

              Code:
              === 2011-12-28 16:37:57,615 [80-7] WARN  DSRequest - SmartClient/SmartGWT Server
               does not currently support sort or filter on fields from non-SQL DataSources wh
              en performing paged fetches. If you need to sort or filter on these fields, use
              a basic fetch (ie, do not specify endRow), but be aware that this may drasticall
              y affect performance.  The following fields have been dropped from the specified
               criteria: null
              === 2011-12-28 16:37:57,615 [80-7] DEBUG RPCManager - Content type for RPC trans
              action: text/plain; charset=UTF-8
              === 2011-12-28 16:37:57,615 [80-7] DEBUG RPCManager - non-DMI response, dropExtr
              aFields: false
              === 2011-12-28 16:37:57,615 [80-7] INFO  Compression - /war/mproject/sc/IDACall:
               188 -> 155 bytes
              === 2011-12-28 16:37:58,239 [80-7] INFO  RequestContext - URL: '/war/mproject/sc
              /IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Fire
              fox/6.0': Moz (Gecko) with Accept-Encoding header
              === 2011-12-28 16:37:58,239 [80-7] DEBUG XML - Parsed XML from (in memory stream
              ): 0ms
              === 2011-12-28 16:37:58,254 [80-7] DEBUG RPCManager - Processing 1 requests.
              === 2011-12-28 16:37:58,254 [80-7] DEBUG RPCManager - Request #1 (DSRequest) pay
              load: {
                  criteria:{
                  },
                  operationConfig:{
                      dataSource:"Manifest",
                      operationType:"fetch",
                      textMatchStyle:"substring"
                  },
                  startRow:278769,
                  endRow:278812,
                  componentId:"isc_ListGrid_0",
                  appID:"builtinApplication",
                  operation:"Manifest_fetch",
                  oldValues:{
                  },
                  additionalOutputs:"Sex:Employees.Sex,SubContractorName:Employees.SubContract
              orName,PrimaryEmail:Employees.PrimaryEmail,CountryOfCitizenship:Employees.Countr
              yOfCitizenship,PassportNumber:Employees.PassportNumber,PassportExpiration:Employ
              ees.PassportExpiration"
              }
              === 2011-12-28 16:37:58,270 [80-7] DEBUG AppBase - [builtinApplication.Manifest_
              fetch] No userTypes defined, allowing anyone access to all operations for this a
              pplication
              === 2011-12-28 16:37:58,270 [80-7] DEBUG AppBase - [builtinApplication.Manifest_
              fetch] No public zero-argument method named '_Manifest_fetch' found, performing
              generic datasource operation
              === 2011-12-28 16:37:58,270 [80-7] INFO  SQLDataSource - [builtinApplication.Man
              ifest_fetch] Performing fetch operation with
                      criteria: {}    values: {}
              === 2011-12-28 16:37:58,285 [80-7] INFO  SQLWhereClause - [builtinApplication.Ma
              nifest_fetch] empty condition
              === 2011-12-28 16:37:58,285 [80-7] INFO  SQLDataSource - [builtinApplication.Man
              ifest_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause
               WHERE $defaultWhereClause AND $defaultJoinWhereClause
              === 2011-12-28 16:37:58,285 [80-7] DEBUG SQLDataSource - [builtinApplication.Man
              ifest_fetch] Executing row count query: SELECT COUNT(*) FROM $defaultTableClause
               WHERE $defaultWhereClause
              === 2011-12-28 16:37:58,285 [80-7] DEBUG SQLDataSource - [builtinApplication.Man
              ifest_fetch] Eval'd row count query: SELECT COUNT(*) FROM manifest, employees WH
              ERE ('1'='1')
              === 2011-12-28 16:37:58,285 [80-7] DEBUG PoolableSQLConnectionFactory - [builtin
              Application.Manifest_fetch] DriverManager fetching connection for manifest via j
              dbc url jdbc:mysql://localhost:3306/manifest
              === 2011-12-28 16:37:58,285 [80-7] DEBUG PoolableSQLConnectionFactory - [builtin
              Application.Manifest_fetch] Passing credentials getConnection separately from JD
              BC URL
              === 2011-12-28 16:37:58,301 [80-7] DEBUG PoolableSQLConnectionFactory - [builtin
              Application.Manifest_fetch] Returning pooled Connection
              === 2011-12-28 16:37:58,301 [80-7] INFO  SQLDriver - [builtinApplication.Manifes
              t_fetch] Executing SQL query on 'manifest': SELECT COUNT(*) FROM manifest, emplo
              yees WHERE ('1'='1')
              === 2011-12-28 16:37:58,317 [80-7] DEBUG SQLDataSource - [builtinApplication.Man
              ifest_fetch] Using SQL Limit query
              === 2011-12-28 16:37:58,317 [80-7] DEBUG SQLDataSource - [builtinApplication.Man
              ifest_fetch] SQL windowed select rows 278769->278812, result size 43. Query: SEL
              ECT manifest.CabinAssignments, manifest.CabinNumber, manifest.CompanyId, manifes
              t.DateOfBirth, manifest.DisembarkDate, manifest.EmbarkDate, manifest.EmployeeId, 
              manifest.EmployeeName, manifest.IsPostManifest, manifest.LastEdited, manifest.
              anifestId, manifest.Position, manifest.PostManifestApproved, manifest.ProjectId
               manifest.ShareBerth, manifest.VisaType, manifest.VisitorType, employees.Sex, e
              ployees.SubContractorName, employees.PrimaryEmail, employees.CountryOfCitizensh
              p, employees.PassportNumber, employees.PassportExpiration FROM manifest, employ
              es WHERE ('1'='1') AND employees.EmployeeId = manifest.EmployeeId LIMIT 278769,
              43
              === 2011-12-28 16:37:58,317 [80-7] DEBUG PoolableSQLConnectionFactory - [builti
              Application.Manifest_fetch] DriverManager fetching connection for manifest via
              dbc url jdbc:mysql://localhost:3306/manifest
              === 2011-12-28 16:37:58,317 [80-7] DEBUG PoolableSQLConnectionFactory - [builti
              Application.Manifest_fetch] Passing credentials getConnection separately from J
              BC URL
              === 2011-12-28 16:37:58,332 [80-7] DEBUG PoolableSQLConnectionFactory - [builti
              Application.Manifest_fetch] Returning pooled Connection
              === 2011-12-28 16:37:58,348 [80-7] INFO  DSResponse - [builtinApplication.Manife
              st_fetch] DSResponse: List with 0 items
              The listgrid code is practically exactly as I have previously posted with the only difference being 1 extra ListGridField.

              No custom Logic at all.

              Any findings yet on the exporting of dynamically included fields?

              Comment


                #8
                Something's wrong here - you're seeing the log message:

                === 2011-12-28 16:37:57,615 [80-7] WARN DSRequest - SmartClient/SmartGWT Server
                does not currently support sort or filter on fields from non-SQL DataSources wh
                en performing paged fetches. If you need to sort or filter on these fields, use
                a basic fetch (ie, do not specify endRow), but be aware that this may drasticall
                y affect performance. The following fields have been dropped from the specified
                criteria: null
                But you previously claimed that the Manifest DataSource was a SQL DataSource.

                Comment


                  #9
                  Yes they are. Its exactly what I have posted previously. But that is the message that I am getting.

                  Here are a few more updates that I have found.

                  1) As for the exporting of included fields..... I switched from Dynamic Includes in my Java code to Field Includes within the xml files and now all of the fields that I want are being exported. Perhaps there is a bug where dynamically included fields are not being exported and/or this was its intention???

                  2) I had a pre-existing ListGrid where I was able to scroll using the scroll bar freely and without errors. The ListGrid at the time had no "Field Include" fields and/or "Dynamic Include" fields. I then added "Field Include" fields. 2 of them, and the following scenario plays out.........

                  - I am able to click the scroll bar arrows and scroll up/down one at a time.
                  - I am able to click somewhere within the scroll bar, but not on the actual scroll icon, and the ListGrid "pages" up/down correctly.

                  - However, once I select the scroll icon, click and drag up/down by any small amount is when the recurring error appears that I have discussed below.

                  This is now happening on two different ListGrids and it only happens when I click and drag the scroll icon up/down ONLY when "Included" fields are being used.

                  I hope this information can help point you more closely to the problem as I really feel that this is a bug since I have no custom code anywhere to handle this.

                  Comment


                    #10
                    Can you give us a way to reproduce any of this? If it's a framework problem, you should be able to create a minimal, runnable test case by just binding a grids to the DataSource you've already shown with appropriate includeFrom settings. Then the only additional thing we'd need to be able to run it is some sample data.

                    Comment


                      #11
                      I have additional debug information regarding the error I am getting.
                      The message shows up on eclipse as soon as the page loads and everytime the error occurs.

                      In my two tables I have the following number of rows:

                      Employees - 2022
                      Manifest - 811

                      Code:
                      WARN:GridBody:isc_ListGrid_0_body:This grid is showing 1,639,842 rows. Due to native rendering limitations, grids with this many rows may not appear correctly on all browsers. Consider filtering the data displayed to the user to reduce the total number of rows displayed at a time. This will improve usability as well as avoiding unpredictable behavior.
                      
                      
                      
                      WARN:GridBody:isc_ListGrid_0_body:This grid is showing 1,639,842 rows. Due to native rendering limitations, grids with this many rows may not appear correctly on all browsers. Consider filtering the data displayed to the user to reduce the total number of rows displayed at a time. This will improve usability as well as avoiding unpredictable behavior.
                          at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
                          at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
                          at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
                          at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
                          at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)
                          at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
                          at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
                          at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
                          at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
                          at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
                          at java.lang.Thread.run(Thread.java:722)
                      I will also attach the file that I created as a test case.

                      The XML files seem to be too large for uploading so I will show them below:

                      Manifest.ds.xml
                      Code:
                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <DataSource ID="Manifest" dbName="manifest"
                      	serverType="sql" tableName="manifest">
                      	<fields>
                      		<field name="ManifestId" type="sequence" primaryKey="true" hidden="true" />
                      		<field name="EmployeeId" type="integer" hidden="true" foreignKey="Employees.EmployeeId" />
                      		<field name="EmployeeName" title="Name" type="text"/>
                      		<field name="LastEdited" title="Last Edited" type="datetime" />
                      		<field includeFrom="Employees.SubContractorName" />
                      	</fields>
                      </DataSource>

                      Employees.ds.xml
                      Code:
                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <DataSource ID="Employees" dbName="manifest"
                      	serverType="sql" tableName="employees">
                      	<fields>
                      		<field name="EmployeeId" type="sequence" primaryKey="true" hidden="true" />
                      		<field name="SubContractorName" title="Subcontractor Company Name" type="text" length="64" />
                      	</fields>
                      </DataSource>
                      Attached Files

                      Comment


                        #12
                        This is a bug in the generation of the rowcount query. It has been fixed in the latest 8.3 build, and also in the 8.2p patched-release build. Tomorrow's nightly builds of both those versions will contain the fix. Thanks for helping us get to the bottom of this.

                        Comment


                          #13
                          Will this fix also be part of the SmartGwt 3.0 build?

                          I take it that when you say 8.3 and 8.2p you are referring to SmartClient?

                          Additionally, has there been any finding on the exporting of dynamically included fields?

                          I had previously mentioned that I worked around it by switching everything to field includes within the xml files.

                          Comment


                            #14
                            Yes, any SmartClient change automatically applies to the corresponding SmartGWT release as well (with a very few exceptions).

                            Comment


                              #15
                              I would just like to report that the 1/5/2012 nightly build seems to have fixed the problem I was experiencing. Thank you for your support.

                              Comment

                              Working...
                              X