Announcement

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

    Update in a ListGrid with some cascading effect on other records

    SmartClient Version: SC_SNAPSHOT-2010-12-19/PowerEdition Deployment (built 2010-12-19) ON GWT 2.0.4

    In our application we have a grid with Content records. When editing these record this will sometimes also 'trigger' changes to other 'Content' records. So the datasource returns a list of all the updated records, with the originally edited record as the first. This all works (which is awesome) when all these returned records are allready fetched in the ListGrid, but if one of the returned records is not in the ListGrids dataset. We get this warning:

    Code:
    Update operation - submitted record with primary key value[s]:{cntn_pk: 259} returned with modified primary key:{cntn_pk: 301}. This may indicate bad server logic. Updating cache to reflect new primary key.
    The originally updated record will also move towards the last position in the ListGrid.

    The request:

    Code:
    {
        "actionURL":"http://127.0.0.1:7001/slims/service/dynamicDataSource", 
        "showPrompt":false, 
        "transport":"xmlHttpRequest", 
        "promptStyle":"dialog", 
        "bypassCache":true, 
        "data":{
            "criteria":{
                "cntn_pk":260
            }, 
            "values":{
                "cntn_pk":260, 
                "Shipment_ID":"klll"
            }, 
            "operationConfig":{
                "dataSource":"Content", 
                "repo":null, 
                "operationType":"update"
            }, 
            "componentId":"Content_GRID1293182847715", 
            "appID":"builtinApplication", 
            "operation":"GridUpdate", 
            "oldValues":{
                "cntn_position_column":2, 
                "exactSearchFields":[
                    "cntn_barCode"
                ], 
                "cntn_createdOn":"2010-04-19T13:59:39", 
                "cntn_status":30, 
                "cntn_fk_contentType":52, 
                "lctn_columns":9, 
                "cntn_modifiedOn":"2010-12-24T09:27:09", 
                "Sample_date":null, 
                "cntn_fk_group":1, 
                "cntn_modifiedBy":"a", 
                "cntp_name":".DNA", 
                "groupPkFieldName":"cntn_fk_group", 
                "cntn_barCode":"0000000218", 
                "lctn_name":"CNT_2130", 
                "grps_groupName":"Service Testing Team", 
                "cntn_fk_customer":null, 
                "cntn_unit":null, 
                "cntn_id":"0000000218", 
                "cntn_fk_source":null, 
                "Arrival_date":null, 
                "userPkFieldName":"cntn_fk_user", 
                "cntn_pk":260, 
                "cntn_quantity":null, 
                "icon":"data_icons/DNA.gif", 
                "cntn_fk_disease":null, 
                "orderByFieldNames":[
                    "cntn_id", 
                    "cntn_pk"
                ], 
                "diss_name":null, 
                "cntn_createdBy":"Cecilia", 
                "sorc_name":null, 
                "cntp_useBarcodeAsId":true, 
                "class":"com.genohm.slims.common.model.Content", 
                "attachmentCount":0, 
                "assignedUserName":"cronetc", 
                "assignedUserGroup":1, 
                "user_userName":"cronetc", 
                "derivedCount":2, 
                "xprs_pk":null, 
                "lctn_rows":9, 
                "Shipment_ID":"kk", 
                "cstm_name":null, 
                "cntn_position_row":1, 
                "cntn_fk_user":16, 
                "cntn_fk_originalContent":247, 
                "cntn_fk_location":285, 
                "rowNum":1
            }
        }
    }
    The response
    Code:
    [
        {
            isDSResponse:true, 
            invalidateCache:false, 
            status:0, 
            data:[
                {
                    cntn_position_column:2, 
                    cntn_status:30, 
                    cntn_fk_contentType:52, 
                    lctn_columns:9, 
                    cntn_modifiedOn:new Date(1293182891000), 
                    Sample_date:null, 
                    cntn_modifiedBy:"a", 
                    cntn_unit:null, 
                    cntn_fk_customer:null, 
                    grps_groupName:"Service Testing Team", 
                    cntn_id:"0000000218", 
                    cntn_fk_source:null, 
                    Arrival_date:null, 
                    cntn_quantity:null, 
                    class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                    assignedUserGroup:1, 
                    assignedUserName:"cronetc", 
                    attachmentCount:0, 
                    derivedCount:2, 
                    lctn_rows:9, 
                    xprs_pk:null, 
                    Shipment_ID:"klll", 
                    cntn_position_row:1, 
                    cntn_fk_originalContent:247, 
                    cntn_fk_location:285, 
                    cntn_createdOn:new Date(1271685579000), 
                    exactSearchFields:[
                        "cntn_barCode"
                    ], 
                    Remarks:null, 
                    cntn_fk_group:1, 
                    Patient_initials:null, 
                    cntp_name:".DNA", 
                    groupPkFieldName:"cntn_fk_group", 
                    cntn_barCode:"0000000218", 
                    lctn_name:"CNT_2130", 
                    cntn_pk:260, 
                    userPkFieldName:"cntn_fk_user", 
                    Screening:null, 
                    cntn_fk_disease:null, 
                    icon:"data_icons/DNA.gif", 
                    cntn_createdBy:"Cecilia", 
                    diss_name:null, 
                    orderByFieldNames:[
                        "cntn_id", 
                        "cntn_pk"
                    ], 
                    sorc_name:null, 
                    cntp_useBarcodeAsId:true, 
                    user_userName:"cronetc", 
                    Pos_ctrl:null, 
                    cstm_name:null, 
                    Neg_ctrl:null, 
                    Patient_ID:null, 
                    cntn_fk_user:16
                }, 
                {
                    cntn_position_column:0, 
                    cntn_status:50, 
                    cntn_fk_contentType:60, 
                    lctn_columns:null, 
                    cntn_modifiedOn:new Date(1293182891000), 
                    Sample_date:null, 
                    Std_curve_MGMT:null, 
                    cntn_modifiedBy:"a", 
                    cntn_unit:null, 
                    cntn_fk_customer:null, 
                    grps_groupName:"Service Testing Team", 
                    cntn_id:"0000000252", 
                    cntn_fk_source:null, 
                    Arrival_date:null, 
                    cntn_quantity:null, 
                    class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                    assignedUserGroup:1, 
                    assignedUserName:"cronetc", 
                    attachmentCount:0, 
                    derivedCount:0, 
                    lctn_rows:null, 
                    xprs_pk:null, 
                    Shipment_ID:"klll", 
                    cntn_position_row:0, 
                    cntn_fk_originalContent:260, 
                    cntn_fk_location:null, 
                    cntn_createdOn:new Date(1271773209000), 
                    exactSearchFields:[
                        "cntn_barCode"
                    ], 
                    Remarks:null, 
                    cntn_fk_group:1, 
                    Patient_initials:null, 
                    cntp_name:".BTDNA", 
                    groupPkFieldName:"cntn_fk_group", 
                    cntn_barCode:"0000000252", 
                    lctn_name:null, 
                    "Std_curve_b-actin":null, 
                    cntn_pk:302, 
                    userPkFieldName:"cntn_fk_user", 
                    Screening:null, 
                    cntn_fk_disease:null, 
                    icon:"data_icons/DNA.gif", 
                    cntn_createdBy:"cronetc", 
                    diss_name:null, 
                    orderByFieldNames:[
                        "cntn_id", 
                        "cntn_pk"
                    ], 
                    sorc_name:null, 
                    cntp_useBarcodeAsId:true, 
                    user_userName:"cronetc", 
                    Pos_ctrl:null, 
                    cstm_name:null, 
                    Neg_ctrl:null, 
                    Patient_ID:null, 
                    cntn_fk_user:16
                }, 
                {
                    cntn_position_column:0, 
                    cntn_status:50, 
                    cntn_fk_contentType:52, 
                    lctn_columns:null, 
                    cntn_modifiedOn:new Date(1293182891000), 
                    Sample_date:null, 
                    cntn_modifiedBy:"a", 
                    cntn_unit:null, 
                    cntn_fk_customer:null, 
                    grps_groupName:"Service Testing Team", 
                    cntn_id:"0000000262", 
                    cntn_fk_source:null, 
                    Arrival_date:null, 
                    cntn_quantity:null, 
                    class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                    assignedUserGroup:1, 
                    assignedUserName:"cronetc", 
                    attachmentCount:0, 
                    derivedCount:0, 
                    lctn_rows:null, 
                    xprs_pk:null, 
                    Shipment_ID:"klll", 
                    cntn_position_row:0, 
                    cntn_fk_originalContent:260, 
                    cntn_fk_location:null, 
                    cntn_createdOn:new Date(1271773346000), 
                    exactSearchFields:[
                        "cntn_barCode"
                    ], 
                    Remarks:null, 
                    cntn_fk_group:1, 
                    Patient_initials:null, 
                    cntp_name:".DNA", 
                    groupPkFieldName:"cntn_fk_group", 
                    cntn_barCode:"0000000262", 
                    lctn_name:null, 
                    cntn_pk:312, 
                    userPkFieldName:"cntn_fk_user", 
                    Screening:null, 
                    cntn_fk_disease:null, 
                    icon:"data_icons/DNA.gif", 
                    cntn_createdBy:"cronetc", 
                    diss_name:null, 
                    orderByFieldNames:[
                        "cntn_id", 
                        "cntn_pk"
                    ], 
                    sorc_name:null, 
                    cntp_useBarcodeAsId:true, 
                    user_userName:"cronetc", 
                    Pos_ctrl:null, 
                    cstm_name:null, 
                    Neg_ctrl:null, 
                    Patient_ID:null, 
                    cntn_fk_user:16
                }
            ]
        }
    ]

    #2
    The error message indicates that you can't change PK on an update, and that's true. Use a remove and add if you want to change a record's PK.

    The request and response pair you showed are the not the ones the error message is about (totally different PKs).

    Comment


      #3
      Oops, I'm sorry I just tried something else between posting the error message and the request response pair.

      Here are the right request and response

      Code:
      {
          "actionURL":"http://127.0.0.1:7001/slims/service/dynamicDataSource", 
          "showPrompt":false, 
          "transport":"xmlHttpRequest", 
          "promptStyle":"dialog", 
          "bypassCache":true, 
          "data":{
              "criteria":{
                  "cntn_pk":259
              }, 
              "values":{
                  "cntn_pk":259, 
                  "Shipment_ID":"kk"
              }, 
              "operationConfig":{
                  "dataSource":"Content", 
                  "repo":null, 
                  "operationType":"update"
              }, 
              "componentId":"Content_GRID1293546953599", 
              "appID":"builtinApplication", 
              "operation":"GridUpdate", 
              "oldValues":{
                  "cntn_position_column":1, 
                  "exactSearchFields":[
                      "cntn_barCode"
                  ], 
                  "cntn_createdOn":"2010-04-19T13:59:39", 
                  "cntn_status":30, 
                  "cntn_fk_contentType":52, 
                  "lctn_columns":9, 
                  "cntn_modifiedOn":"2010-12-28T14:26:38", 
                  "Sample_date":"2010-12-23", 
                  "Patient_initials":"ll", 
                  "cntn_fk_group":1, 
                  "cntn_modifiedBy":"a", 
                  "cntp_name":".DNA", 
                  "groupPkFieldName":"cntn_fk_group", 
                  "cntn_barCode":"0000000217", 
                  "lctn_name":"CNT_2130", 
                  "grps_groupName":"Service Testing Team", 
                  "cntn_fk_customer":null, 
                  "cntn_unit":null, 
                  "cntn_id":"0000000217", 
                  "cntn_fk_source":null, 
                  "Arrival_date":"2010-12-23", 
                  "userPkFieldName":"cntn_fk_user", 
                  "cntn_pk":259, 
                  "Screening":null, 
                  "cntn_quantity":1, 
                  "icon":"data_icons/DNA.gif", 
                  "cntn_fk_disease":null, 
                  "orderByFieldNames":[
                      "cntn_id", 
                      "cntn_pk"
                  ], 
                  "diss_name":null, 
                  "cntn_createdBy":"Cecilia", 
                  "sorc_name":null, 
                  "cntp_useBarcodeAsId":true, 
                  "class":"com.genohm.slims.common.model.Content", 
                  "attachmentCount":0, 
                  "assignedUserName":"cronetc", 
                  "assignedUserGroup":1, 
                  "user_userName":"cronetc", 
                  "derivedCount":2, 
                  "xprs_pk":null, 
                  "lctn_rows":9, 
                  "Shipment_ID":"k", 
                  "cstm_name":null, 
                  "cntn_position_row":1, 
                  "Patient_ID":null, 
                  "cntn_fk_user":16, 
                  "cntn_fk_originalContent":246, 
                  "cntn_fk_location":285
              }
          }
      }
      Code:
      [
          {
              isDSResponse:true, 
              invalidateCache:false, 
              status:0, 
              data:[
                  {
                      cntn_position_column:1, 
                      cntn_status:30, 
                      cntn_fk_contentType:52, 
                      lctn_columns:9, 
                      cntn_modifiedOn:new Date(1293547000000), 
                      Sample_date:new Date(1293058800000), 
                      cntn_modifiedBy:"a", 
                      cntn_unit:null, 
                      cntn_fk_customer:null, 
                      grps_groupName:"Service Testing Team", 
                      cntn_id:"0000000217", 
                      cntn_fk_source:null, 
                      Arrival_date:new Date(1293058800000), 
                      cntn_quantity:1, 
                      class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                      assignedUserGroup:1, 
                      assignedUserName:"cronetc", 
                      attachmentCount:0, 
                      derivedCount:2, 
                      lctn_rows:9, 
                      xprs_pk:null, 
                      Shipment_ID:"kk", 
                      cntn_position_row:1, 
                      cntn_fk_originalContent:246, 
                      cntn_fk_location:285, 
                      cntn_createdOn:new Date(1271685579000), 
                      exactSearchFields:[
                          "cntn_barCode"
                      ], 
                      Remarks:null, 
                      cntn_fk_group:1, 
                      Patient_initials:"ll", 
                      cntp_name:".DNA", 
                      groupPkFieldName:"cntn_fk_group", 
                      cntn_barCode:"0000000217", 
                      lctn_name:"CNT_2130", 
                      cntn_pk:259, 
                      userPkFieldName:"cntn_fk_user", 
                      Screening:null, 
                      cntn_fk_disease:null, 
                      icon:"data_icons/DNA.gif", 
                      cntn_createdBy:"Cecilia", 
                      diss_name:null, 
                      orderByFieldNames:[
                          "cntn_id", 
                          "cntn_pk"
                      ], 
                      sorc_name:null, 
                      cntp_useBarcodeAsId:true, 
                      user_userName:"cronetc", 
                      Pos_ctrl:null, 
                      cstm_name:null, 
                      Neg_ctrl:null, 
                      Patient_ID:null, 
                      cntn_fk_user:16
                  }, 
                  {
                      cntn_position_column:0, 
                      cntn_status:50, 
                      cntn_fk_contentType:60, 
                      lctn_columns:null, 
                      cntn_modifiedOn:new Date(1293547000000), 
                      Sample_date:new Date(1293058800000), 
                      Std_curve_MGMT:null, 
                      cntn_modifiedBy:"a", 
                      cntn_unit:null, 
                      cntn_fk_customer:null, 
                      grps_groupName:"Service Testing Team", 
                      cntn_id:"0000000251", 
                      cntn_fk_source:null, 
                      Arrival_date:new Date(1293058800000), 
                      cntn_quantity:null, 
                      class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                      assignedUserGroup:1, 
                      assignedUserName:"cronetc", 
                      attachmentCount:0, 
                      derivedCount:0, 
                      lctn_rows:null, 
                      xprs_pk:null, 
                      Shipment_ID:"kk", 
                      cntn_position_row:0, 
                      cntn_fk_originalContent:259, 
                      cntn_fk_location:null, 
                      cntn_createdOn:new Date(1271773209000), 
                      exactSearchFields:[
                          "cntn_barCode"
                      ], 
                      Remarks:null, 
                      cntn_fk_group:1, 
                      Patient_initials:"ll", 
                      cntp_name:".BTDNA", 
                      groupPkFieldName:"cntn_fk_group", 
                      cntn_barCode:"0000000251", 
                      lctn_name:null, 
                      "Std_curve_b-actin":null, 
                      cntn_pk:301, 
                      userPkFieldName:"cntn_fk_user", 
                      Screening:null, 
                      cntn_fk_disease:null, 
                      icon:"data_icons/DNA.gif", 
                      cntn_createdBy:"cronetc", 
                      diss_name:null, 
                      orderByFieldNames:[
                          "cntn_id", 
                          "cntn_pk"
                      ], 
                      sorc_name:null, 
                      cntp_useBarcodeAsId:true, 
                      user_userName:"cronetc", 
                      Pos_ctrl:null, 
                      cstm_name:null, 
                      Neg_ctrl:null, 
                      Patient_ID:null, 
                      cntn_fk_user:16
                  }, 
                  {
                      cntn_position_column:0, 
                      cntn_status:50, 
                      cntn_fk_contentType:52, 
                      lctn_columns:null, 
                      cntn_modifiedOn:new Date(1293547001000), 
                      Sample_date:new Date(1293058800000), 
                      cntn_modifiedBy:"a", 
                      cntn_unit:null, 
                      cntn_fk_customer:null, 
                      grps_groupName:"Service Testing Team", 
                      cntn_id:"0000000261", 
                      cntn_fk_source:null, 
                      Arrival_date:new Date(1293058800000), 
                      cntn_quantity:null, 
                      class:"com.genohm.slims.common.model.Content_$$_javassist_22", 
                      assignedUserGroup:1, 
                      assignedUserName:"cronetc", 
                      attachmentCount:0, 
                      derivedCount:0, 
                      lctn_rows:null, 
                      xprs_pk:null, 
                      Shipment_ID:"kk", 
                      cntn_position_row:0, 
                      cntn_fk_originalContent:259, 
                      cntn_fk_location:null, 
                      cntn_createdOn:new Date(1271773346000), 
                      exactSearchFields:[
                          "cntn_barCode"
                      ], 
                      Remarks:null, 
                      cntn_fk_group:1, 
                      Patient_initials:"ll", 
                      cntp_name:".DNA", 
                      groupPkFieldName:"cntn_fk_group", 
                      cntn_barCode:"0000000261", 
                      lctn_name:null, 
                      cntn_pk:311, 
                      userPkFieldName:"cntn_fk_user", 
                      Screening:null, 
                      cntn_fk_disease:null, 
                      icon:"data_icons/DNA.gif", 
                      cntn_createdBy:"cronetc", 
                      diss_name:null, 
                      orderByFieldNames:[
                          "cntn_id", 
                          "cntn_pk"
                      ], 
                      sorc_name:null, 
                      cntp_useBarcodeAsId:true, 
                      user_userName:"cronetc", 
                      Pos_ctrl:null, 
                      cstm_name:null, 
                      Neg_ctrl:null, 
                      Patient_ID:null, 
                      cntn_fk_user:16
                  }
              ]
          }
      ]

      Comment


        #4
        Multiple records as a response to an update is also unexpected, but what you can do is put together the related updates under a single field (as a List of Maps or Beans server-side, for example) and use DataSource.updateCaches() client-side to "broadcast" the changes to all other components.

        Comment

        Working...
        X