Announcement

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

    Inline picklist not getting new value since 5.5rc1

    We have an editable ListGrid where one field's editor gets values from a valueMap and is thus a picklist. After upgrading from version 5.5b2 to 5.5.1, the picklist doesn't display the new value after the value is changed; it reverts to the old value even though the update happened successfully on the server. I checked the behavior under 5.5rc1 and saw the same problem as in 5.5.1.

    The entire ListGrid definition is a bit long to include here; below is a representative RPC update request payload, the corresponding response text, the XML datasource definition and the related ListGridField definition. The primary key field is 'compositeID' and the field we're updating in the request is 'overrideRightCode,' Let me know what other information would be helpful.

    Thanks, Chris

    Request payload:

    Code:
    payload: {
        values:{
            compositeID:"PermissionInstance|10000234|0|0|10000033",
            overrideRightCode:"G"
        },
        operationConfig:{
            dataSource:"IscDsPermission",
            operationType:"update"
        },
        appID:"builtinApplication",
        operation:"IscDsPermission_update",
        oldValues:{
            publicationCollectionID:0,
            compositeID:"PermissionInstance|10000234|0|0|10000033",
            overrideRightCode:"C",
            inheritedRightCode:"UNDEFINED",
            agreementID:10000234,
            typeOfUseID:10000033,
            overrideRightID:11238207,
            typeOfUseDescription:"EMAIL INTERNAL",
            publicationID:0,
            _selection_9:true
        },
        criteria:{
            compositeID:"PermissionInstance|10000234|0|0|10000033"
        }
    }
    Response Text:

    Code:
    "//isc_RPCResponseStart-->[{"invalidateCache":false,"data":[{"publicationCollectionID":0,"compositeID":"PermissionInstance|10000234|0|0|10000033","overrideRightCode":"G","inheritedRightCode":"UNDEFINED","agreementID":10000234,"typeOfUseID":10000033,"overrideRightID":11238207,"typeOfUseDescription":"EMAIL INTERNAL","publicationID":0}],"endRow":0,"status":0,"isDSResponse":true,"totalRows":0,"startRow":0}]//isc_RPCResponseEnd"
    Datasource definition:

    Code:
    <DataSource ID="IscDsPermission" serverType="generic">
        <fields>
            <field name="compositeID" type="text" primaryKey="true" />
    
            <field name="typeOfUseID" type="integer" />
            <field name="overrideRightID" type="integer" />
    
            <field name="agreementID" type="integer" />
            <field name="publicationID" type="integer" />
            <field name="publicationCollectionID" type="integer" />
    
            <field name="overrideRightCode" type="text" />
    
            <field name="inheritedRightCode" type="text" />
            <field name="typeOfUseDescription" type="text" />
        </fields>
    
        <serverObject
            lookupType="new"
            className="naples.web.isc.datasource.IscDsPermission"
        />
    
    </DataSource>
    ListGridField

    Code:
            this.overrideRightField = {
                name:"overrideRightCode",
                ID:"overrideRightField",
                title:"Assigned Right",
                editorValueMap:RightsEditor.getEditorMap(),
                editorType:"select",
                canEdit:true,
                modalEditing:true,
                sortNormalizer:"return recordObject.compositeID",
                editorProperties:{
                    controlStyle:"naplesRightPickerControl",
                    textBoxStyle:"naplesRightPickerTextBox",
                    editorEnter:"this.showPickList()",
                    height:22,
                    pickButtonHeight:18,
                    showOver:true,
                    pickListProperties:{
                        cellHeight:25
                    },
                    pickValue : function (arguments ) {
                        this.Super("pickValue", arguments);
                        this.grid.endEditing();
                    }
                }
            };

    #2
    Hi Chris,

    I haven't been able to reproduce this yet. Below is a boiled-down test case. Could you tell me:

    1. what does the valueMap retrieved from getEditorMap() look like, and do you update it dynamically at any time?

    2. what do you see in the log window if you enable DEBUG-level logging for the ResultSet category?

    Code:
    <SCRIPT>
    
    <isc:XML>
    <DataSource ID="IscDsPermission" serverType="generic" clientOnly="true">
        <fields>
            <field name="compositeID" type="text" primaryKey="true" />
    
            <field name="typeOfUseID" type="integer" />
            <field name="overrideRightID" type="integer" />
    
            <field name="agreementID" type="integer" />
            <field name="publicationID" type="integer" />
            <field name="publicationCollectionID" type="integer" />
    
            <field name="overrideRightCode" type="text" />
    
            <field name="inheritedRightCode" type="text" />
            <field name="typeOfUseDescription" type="text" />
        </fields>   
        <testData>
            <List>
                <IscDsPermission compositeID="4" overrideRightCode="G"/>
                <IscDsPermission compositeID="5" overrideRightCode="F"/>
                <IscDsPermission compositeID="6" overrideRightCode="H"/>
            </List>
        </testData>
    
    </DataSource>
    </isc:XML>
    
    isc.ListGrid.create({
        ID:"theGrid",
        dataSource:"IscDsPermission",
        canEdit:true,
        fields : [
            { name : "compositeID" },
            { name:"overrideRightCode",
                ID:"overrideRightField",
                title:"Assigned Right",
                //editorValueMap:RightsEditor.getEditorMap(),
                editorValueMap:["G", "F", "H"],
                editorType:"select",
                canEdit:true,
                modalEditing:true,
                sortNormalizer:"return recordObject.compositeID",
                editorProperties:{
                 //   controlStyle:"naplesRightPickerControl",
                 //   textBoxStyle:"naplesRightPickerTextBox",
                    editorEnter:"this.showPickList()",
                    height:22,
                    pickButtonHeight:18,
                    showOver:true,
                    pickListProperties:{
                        cellHeight:25
                    },
                    pickValue : function (arguments ) {
                        this.Super("pickValue", arguments);
                        this.grid.endEditing();
                    }
                }
            }
        ]
    }).fetchData();
    
    <SCRIPT>

    Comment


      #3
      More information, answers to 1 and 2...

      OK, thanks for the response; here's some more information:

      getEditorMap() builds a map that associates the possible values for overrideRightCode field to HTML strings for display in the dropdown. I generate the map with a function because it didn't look like I could cause formatCellValue() or formatEditorValue() to apply to dropdown elements, and I didn't want to hard-code each HTML string for each value. The output of the getEditorMap() function looks like this, when evaluated in the SmartClient developer console:

      Code:
      {G: "<table class='naplesRightDisplay'><tr><t..."[213],
      C: "<table class='naplesRightDisplay'><tr><t..."[231],
      B: "<table class='naplesRightDisplay'><tr><t..."[229],
      BP: "<table class='naplesRightDisplay'><tr><t..."[224],
      D: "<table class='naplesRightDisplay'><tr><t..."[211],
      I: "<table class='naplesRightDisplay'><tr><t..."[225],
      UNDEFINED: "<table class='naplesRightDisplay'><tr><t..."[227]}
      The entire first entry looks like this:

      Code:
      G: "<table class='naplesRightDisplay'><tr><td class='naplesRightIconCell'><img src='/naples-prelim/isomorphic/skins/naples/images/naples/perm_prepaid.gif'></td><td class='naplesRightTextCell'>Granted</td></tr></table>"
      I got the following message in the developer console with DEBUG-level logging for ResultSet:

      Code:
      16:05:46.640:WARN:RightsEditor:isc_RightsEditor_22:Record:{compositeID: "PermissionInstance|10000234|0|0|10000032"}, lost from local cache in paged result set. Pending edits for this record will be maintained.
      This seems promising. I get this behavior when my server-side DataSource puts a list of records (of length 1) into DSResponse.setData() as a result of the update() operation. If I pass the object itself to setData(), however, I don't get this message, and the UI dropdown behavior is different, but still not right. The dropdown seems to stay dropped-down (or drops itself down again) after the edit takes place. Hitting the enter key while the dropdown is open after the edit closes it and returns the field value to the original, not edited value. So the behavior is similar, but for some reason the dropdown stays open after selecting a value.

      Hope this makes sense; It seems like there are a few different things going on here.
      Last edited by ccollier; 4 Jan 2007, 13:21.

      Comment


        #4
        Hi Chris,

        Thanks for the additional info.

        Sending back an List with one record is the correct return format, although in the next release just a record with no List will also be accepted.

        Your getEditorMap() looks fine and is almost certainly not the problem.

        Further questions:

        1. when the value in the select field is dropped, do the other edits in the same row also get dropped?

        2. do you still see this problem if you remove the pickValue() override below?

        3. how is the select control being re-shown? normal behavior when you endEditing() as below would be to return to non-editable display

        4. does the stale value persist if you manually redraw() the grid?

        5. what do you get if you call grid.getEditValues(editedRowNum) ?
        Last edited by Isomorphic; 18 Jan 2007, 16:18.

        Comment


          #5
          revisiting this thread - still working on a solution

          Hi; picking this thread up again, as we've got a release coming up I need to solve this problem for. I hope this thread can be continued after the time lapse in my response.

          To reiterate, the key information seems to be:

          1. I AM getting a the following error on the client side in the developer console:
          Record:{compositeID: "XXX"}, lost from local cache in paged result set. Pending edits for this record will be maintained.
          Responses to your questions from the last post:

          2. getEditValues(editedRowNum) gives me the value of the primary key field (compositeID). I'm not sure what the intended functionality of getEditValues() is, but I expected to see the value of the field I just edited.

          3. I am not changing the value of the compositeID field in my server side service code. The object in question does implement equals() and hashCode(), not sure if this has any bearing on client-side behavior...


          Here are responses for the other questions in your previous post

          1. There are no other edits in the same row, so it's a bit hard to diagnose this way. I could mock up another edit on the row, but I'm hoping not to have to do this.

          2. Yes, I still see the problem if I remove the pickValue() override.

          3. I call endEditing() inside pickValue(); I think this was something I was advised to do in response to an earlier question about automatically submitting edits when the dropdown value is picked (to provide behavior similar to a regular HTML or Windows GUI dropdown, where editing is finished as soon as the dropdown closes)

          4. The stale value goes away if I load a different record and show it in the grid, then re-load the original record (I'm doing a completely fresh retrieval of the values), but not if I call redraw() in, say, pickValue().
          Last edited by ccollier; 5 Mar 2007, 11:41.

          Comment


            #6
            Hi Chris,

            Glad you're taking another look at this.

            This is a bit of a mystery, because, if redraw() is not showing you updated data, then the client-side cache must not have received the updates, however all of the logs you have shown here indicate that cache update should be succeeding. Something is amiss..

            1. If you set the ResultSet log category to DEBUG you should see some logs like these:

            Code:
            19:15:07.384:TMR0:INFO:ResultSet:isc_ResultSet_79:Updating cache: operationType 'update', 1 rows update data:
            [
            {gdp: 2504000,
            continent: "North America",
            article: "http://en.wikipedia.org/wiki/Germany",
            countryName: "Germany",
            population: 82422299,
            member_g8: true,
            countryCode: "GM",
            capital: "Berlin",
            area: 357021,
            government: "federal republic",
            pk: 5,
            independence: Date(1/18/1871)}
            ]
            19:15:07.384:TMR0:DEBUG:ResultSet:isc_ResultSet_79:updated cache, 1 out of 1 rows remain in cache, 0 row(s) added.
            19:15:07.384:TMR0:DEBUG:ResultSet:isc_ResultSet_79:full length set to: 15
            Can you show us what these logs look like in your application?

            2. if you access the data for the updated row in the resultSet directly, eg, isc.Log.echo(grid.data.get(rowNum)), what do you see?

            3. after the save, what exactly is showing? Are the editors dismissed, or are they re-shown? If they are re-shown, what code does this?

            Comment


              #7
              Based on information provided offline, this was due to an override of listGrid.fetchData() that would manually call dataSource.fetchData() with modified criteria, then call listGrid.setData() with the resulting Array.

              listGrid.fetchData() normally creates a ResultSet to manage paging and automatic cache synchronization. An ordinary Array as retrieved from dataSource.fetchData() does not participate in automatic cache synchronization.

              The solution was to change the fetchData() override so that it would simply call Super() after modifying the passed criteria parameter, so that the ListGrid's normal behavior of constructing a ResultSet would still occur.

              Comment

              Working...
              X