Announcement

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

    Queuing on ListGrid edit.

    We have a big list grid, with lots of columns. A good number of those columns are ComboBoxItem picklists, and currently upon editing a row a number of queries are issued to fetchMissingValues.

    Is there anyway to do an RPCManager.startQueue() when the row is activated, and an RPCManager.sendQueue() when complete, so that instead of 4-20 individual RPCs hitting the server, we get all the missing values in a single request/response?

    SmartClient Version: v9.1p_2015-04-22/PowerEdition Deployment (built 2015-04-22)

    #2
    Yes, you can do this. For the case of editing that's initiated by a click, you could startQueue() on mouseDown, then sendQueue() on rowEditorEnter.

    For row to row transition, you could startQueue() on rowEditorExit.

    However, we plan to take a look at this to see whether queuing should just be automatic here, so you might want to wait for that result before you start implementing the approach outlined above (where there will be a number of details to get right).

    Comment


      #3
      We've made a change to make queuing automatic for the option-data-source fetches in this case. This change will be present in the nightly builds dated May 2 or above, on the 9.1p, 10.0p and 10.1d branches

      Regards
      Isomorphic Software

      Comment


        #4
        Thanks! Isomorphic Rocks!

        Comment


          #5
          I'm using SmartClient Version: v9.1p_2015-05-02/PowerEdition Deployment (built 2015-05-02) and this doesn't appear to be working - it's still doing individual requests for each drop down.

          Comment


            #6
            In our testing, this is working in the 9.1p branch.

            A first question: Is your application backed by the SmartClient server, or are you working with REST DataSources, or something else that might not support queuing of requests?

            Assuming you are working against SmartClient server dataSources, we'll need to see the problem in action to understand why this feature isn't behaving as it should for you.
            Could you show us
            - the ListGrid definition, including fields / any editor properties, etc
            - the dataSource definition for the ListGrid

            This should give us enough to build a test case with dummy data and potentially reproduce the problem on our end -- or failing that, show you a working test case which may give you a jumping off point to figuring out why it doesn't work within your application.

            Thanks
            Isomorphic Software

            Comment


              #7
              Yes, we're using SmartClient server.

              Our codebase is quite large, and abstracting things out can be difficult, but I will attempt to provide you something usable.

              In this example, the ITEMS table has CATEGORY_ID, CATEGORY and TYPE_ID, TYPE. CATEGORY and TYPE are the CODE columns in their respective parent tables. In our environment, this may be denormalized, the table may be a view, or a left outer join might be added via a <tableClause/>.

              We permit only selecting active values in the editor through the use of an optionOperationId, and a severConstructor.

              com.company.smartclient.ds.LookupDataSource:
              Code:
              package com.company.smartclient.ds;
              
              import com.isomorphic.datasource.DSRequest;
              import com.isomorphic.datasource.DSResponse;
              import com.isomorphic.sql.SQLDataSource;
              
              public class LookupDataSource extends SQLDataSource {
              	private static final long serialVersionUID = 7017052622165958459L;
              	
              	@Override
              	public DSResponse executeFetch(DSRequest dsRequest) throws Exception {
              				
              		switch (dsRequest.getOperationId()) {
              			// ....
              			// pickLists don't get historical values
              			case "picklist": {
              				dsRequest.addToCriteria("STATUS", "notEqual", "H");
              				break;
              			}
              			
              			default: {
              				
              			}
              		}
              
              		return super.executeFetch(dsRequest);
              	}
              
              }
              ITEMS.ds.xml:
              Code:
              <DataSource 
                 serverType="sql" 
                 dbName="SQLServer" 
                 schema="dbo" 
                 tableName="ITEMS" 
                 ID="ITEMS"
                 serverConstructor="com.company.smartclient.ds.ReferenceTableDataSource" 
                 autoDeriveSchema="true">
                    <fields>
                       <field name="ITEM_ID" type="sequence" primaryKey="true" hidden="true"/>
                       <field name="CODE" type="text"/>
                       <field name="TITLE" type="text"/>
                       <field name="CATEGORY_ID" type="CATEGORY_ID" foreignKey="CATEGORY.CATEGORY_ID" displayField="CATEGORY"/>
                       <field name="CATEGORY" type="text" canSave="false" hidden="true"/>
                       <field name="TYPE_ID" type="TYPE_ID" foreignKey="TYPES.TYPE_ID" displayField="TYPE"/>
                       <field name="TYPE" type="text" canSave="false" hidden="true"/>
              
                       <field name="STATUS"  type="enum" length="1" canEdit="false">
                          <valueMap>
                             <value id="A">Active</value>
                             <value id="P">Pending</value>
                             <value id="H">Historical</value>
                          </valueMap>
                       </field>
                       <field name="COMMENTS" type="text"/>
                    </fields>
              </DataSource>
              CATEGORIES.ds.xml:
              Code:
              <DataSource 
                 serverType="sql" 
                 dbName="SQLServer" 
                 schema="dbo" 
                 tableName="CATEGORIES" 
                 ID="CATEGORIES"
                 serverConstructor="com.company.smartclient.ds.ReferenceTableDataSource" 
                 autoDeriveSchema="true">
                    <fields>
                       <field name="CATEGORY_ID" type="sequence" primaryKey="true" hidden="true"/>
                       <field name="CODE" type="text"/>
                       <field name="TITLE" type="text"/>
                       <field name="STATUS"  type="enum" length="1" canEdit="false">
                          <valueMap>
                             <value id="A">Active</value>
                             <value id="P">Pending</value>
                             <value id="H">Historical</value>
                          </valueMap>
                       </field>
                       <field name="COMMENTS" type="text"/>
                    </fields>
              </DataSource>
              CATEGORY_ID.type.xml:
              Code:
              <SimpleType ID="CATEGORY_ID" name="CATEGORY_ID" inheritsFrom="sequence" editorType="CategoryIdItem" >
                  <validOperators>equals</validOperators>
                  <validOperators>notEqual</validOperators>
                  <fieldProperties>
                      <editorProperties>
                          <valueField>CATEGORY_ID</valueField>
                          <displayField>CODE</displayField>
                      </editorProperties>
                      <filterEditorProperties>
                          <valueField>CATEGORY_ID</valueField>
                          <displayField>CODE</displayField>
                      </filterEditorProperties>
                      <filterOperator>equals</filterOperator>
                      <filterEditorType>CategoryIdFilter</filterEditorType>
                  </fieldProperties>
              </SimpleType>
              TYPES.ds.xml:
              Code:
              <DataSource 
                 serverType="sql" 
                 dbName="SQLServer" 
                 schema="dbo" 
                 tableName="TYPES" 
                 ID="TYPES"
                 serverConstructor="com.company.smartclient.ds.ReferenceTableDataSource" 
                 autoDeriveSchema="true">
                    <fields>
                       <field name="TYPE_ID" type="sequence" primaryKey="true" hidden="true"/>
                       <field name="CODE" type="text"/>
                       <field name="TITLE" type="text"/>
                       <field name="STATUS"  type="enum" length="1" canEdit="false">
                          <valueMap>
                             <value id="A">Active</value>
                             <value id="P">Pending</value>
                             <value id="H">Historical</value>
                          </valueMap>
                       </field>
                       <field name="COMMENTS" type="text"/>
                    </fields>
              </DataSource>
              TYPE_ID.type.xml:
              Code:
              <SimpleType ID="TYPE_ID" name="TYPE_ID" inheritsFrom="sequence" editorType="TypeIdItem" >
                  <validOperators>equals</validOperators>
                  <validOperators>notEqual</validOperators>
                  <fieldProperties>
                      <editorProperties>
                          <valueField>TYPE_ID</valueField>
                          <displayField>CODE</displayField>
                      </editorProperties>
                      <filterEditorProperties>
                          <valueField>TYPE_ID</valueField>
                          <displayField>CODE</displayField>
                      </filterEditorProperties>
                      <filterOperator>equals</filterOperator>
                      <filterEditorType>TypeIdFilter</filterEditorType>
                  </fieldProperties>
              </SimpleType>
              PickListItem.js:
              Code:
              isc.defineClass("PickListItem", "ComboBoxItem").addProperties({
                 optionOperationId:'picklist',
                 displayField:"CODE",
                 addUnknownValues: false,
                 pickListWidth: 600,
                 loadingDisplayValue:'',
                 pickListProperties: {
                    autoFitFieldWidths: true,
                    autoFitWidthApproach: "both",
                    showFilterEditor:true
                 }
              });
              PickListItemFilter.js:
              Code:
              isc.defineClass("PickListItemFilter", "ComboBoxItem").addProperties({
                 displayField:"CODE",
                 addUnknownValues: false,
                 pickListWidth: 600,
                 pickListProperties: {
                    autoFitFieldWidths: true,
                    autoFitWidthApproach: "both",
                    showFilterEditor:false
                 }
              });
              categoryPicklists.js:
              Code:
              isc.defineClass("CategoryIdItem", "PickListItem").addProperties({
                 valueField:"CATEGORY_ID",
                 optionDataSource: "CATEGORIES",
                 pickListFields: [
                    {name:'CODE'},
                    {name:'TITLE'},
                    {name:'STATUS'}
                 ]
              
              });
              
              isc.defineClass("CategoryIdFilter", "PickListItemFilter").addProperties({
                 valueField:"CATEGORY_ID",
                 optionDataSource: "CATEGORIES",
                 pickListFields: [
                    {name:'CODE'},
                    {name:'TITLE'},
                    {name:'STATUS}
                 ]
              });
              typePicklists.js:
              Code:
              isc.defineClass("TypeIdItem", "PickListItem").addProperties({
                 valueField:"TYPE_ID",
                 optionDataSource: "TYPES",
                 pickListFields: [
                    {name:'CODE'},
                    {name:'TITLE'},
                    {name:'STATUS'}
                 ]
              
              });
              
              isc.defineClass("TypeIdFilter", "PickListItemFilter").addProperties({
                 valueField:"TYPE_ID",
                 optionDataSource: "TYPES",
                 pickListFields: [
                    {name:'CODE'},
                    {name:'TITLE'},
                    {name:'STATUS}
                 ]
              });
              (our grid is actually a bit more complex, with a custom toolbar and total rows footer, config menu, and state persistence, but this is the meat of it).
              LookupGrid.js:
              Code:
              isc.defineClass("LookupListGrid", "ListGrid").addProperties({
                 	dataProperties : { useClientFiltering : false, useClientSorting : false },
              	useAllDataSourceFields: true,
              	allowFilterExpressions : true,
              	canEdit : true,
              	autoFitFieldWidths:true,
              	autoFitWidthApproach:"both",
              	autoFitExpandField: "COMMENTS",
              	autoFitClipFields:["COMMENTS,TITLE"],
              	editEvent : "doubleClick",
              	modalEditing : true,
              	canFreezeFields : true,
              	canGroupBy : false,
              	leaveScrollbarGap : true,
              	canMultiSort : true, 
              	autoFitWidth : true, 
              	showFilterEditor: true,  
              	filterOnKeypress : false, 
              	alternateRecordStyles : true, 
              	autoFetchData : true, 
              	selectionType : "single",
                      initWidget: function() {
                         this.gridComponents = ["header","filterEditor","body"];
                         this.Super("initWidget",arguments);
                      }
              });
              We then create an LookupLisGrid with {dataSource:"ITEMS"}. Double clicking on an item to edit it, two requests are made -- one to CATEGORIES and one to TYPES, to load the current values.

              Comment


                #8
                So, I tried with the latest nightly, and this still isn't working for us. Requests are not queued on initial edit, nor as we scroll (showAllColumns is left to the default, false).

                This at least enables the queue for the initial values at the start of the recording for us:
                Code:
                rowDoubleClick: function(record, recordNum, fieldNum, keyboardGenerated) {
                   RPCManager.startQueue();
                   return this.Super("rowDoubleClick",arguments);
                },
                rowEditorEnter: function(record, editValues, rowNum) {
                   RPCManager.sendQueue();
                   return this.Super("rowEditorEnter",arguments);
                }
                That doesn't help with when the draw area changes.

                Is there any way to get the picklists not to attempt to fetchMissingData, and yet still show the value from the displayField in the editor, and avoid these hits completely until the picklist is opened?

                Comment


                  #9
                  We're taking a look and will follow up when we have an understanding of what's going on for you

                  Regards
                  Isomorphic Software

                  Comment


                    #10
                    Ok - we've tweaked our fix to address the issue where queuing wasn't happening automatically. You should now (with the next nightly build) see queued requests when first showing the editor, and again when showing new edit items due to incremental rendering of columns.

                    Regards
                    Isomorphic Software

                    Comment


                      #11
                      I'm pleased to say this is working like a champ on SmartClient Version: v9.1p_2015-05-13/PowerEdition Deployment (built 2015-05-13)

                      Comment


                        #12
                        Great to hear!

                        Regards
                        Isomorphic software

                        Comment

                        Working...
                        X