Announcement

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

    Problem with ListGrid.setEditValue()

    I'm using SmartClient Version: v12.0p_2018-07-28

    I found a problem (or bug), which is a little bit difficult to explain.

    Problem: It is not possible to set an new value with listgrid.setEditValue( recidx, field, newValue),
    if :
    • the "listgrid" has a datasource
    • “field” is of type “date”
    • “field” is in the datasource, but not in the field list of the listgrid (so "field" is not visible)
    • actual value of “field” is not null
    • "newValue" is not null

    I debugged the code and could find two problems:

    First in ISC_grids.js, line 49255:
    Code:
    var field = this.getField(fieldName);
    this should be:
    Code:
    var field = this.getUnderlyingField(fieldName);
    I changes this and my code worked as expected.

    But there is a second problem with “isc.DynamicForm.compareValues” in ISC_forms.js (line 16943ff) called later.
    Because this function compares two values of type “date” as “objects” by comparing all properties, but it does not compare the date-value itself.
    So two different dates are always “equal”.

    I hope my explanation is understandable.

    Thanks and best regards
    Burkhard

    #2
    Hello burkhard,

    We do appreciate your debugging efforts, but we can’t do anything with this report - what we need is a test case that shows that the framework is not behaving as expected and documented.

    Comment


      #3
      So here is an example.
      Modify your show case example “Data Bindings” – “List” – “DataSource fields”

      Code:
      isc.ListGrid.create({
      ID: "countryList",
      width:550, height:224, alternateRecordStyles:true,
      dataSource: countryDS,
      fields:[
      {name:"countryName", title:"Country"},
      {name:"countryCode", title:"Code"},
      // {name:"independence", title:"Independence", type:"date"},
      {name:"population", title:"Population", type:"integer"},
      {name:"gdp", title:"GDP ($B)", type:"float"}
      ],
      autoFetchData: true
      })
      If you try this, the first record in the grid should be “United States”

      In the js-console try following js-code:

      Code:
      countryList.setEditValue(0, "independence", new Date())
      This should set the independence date to now. But the result is “false” – “no change”

      If you try
      Code:
      countryList.setEditValue(0, "independence", isc.DateUtil.createLogicalDate( 2018, 7 ,22))
      The result is true, because the old value is of type “date” and the new logicaldate has a property “logicalDate” set to true as difference

      Try next
      Code:
      countryList.setEditValue(0, "independence", isc.DateUtil.createLogicalDate( 2018, 7 ,23))
      Result is false again because old and new value are logicalDates with the same properties.

      if you try
      Code:
      countryList.setEditValue(1, "independence", isc.DateUtil.createLogicalDate( 2018, 7 ,23))
      Result is true, because old value "independence" was null for “China” as second row.

      If you uncomment the field definition for “independence” everything works fine, because the field is now in the field list of the listgrid and so its data type is mentioned for comparison.

      Best regards
      Burkhard

      Comment


        #4
        Hi Isomorphic team,

        did the test case help you to find the problem? Do you need more information?

        best regards
        Burkhard

        Comment


          #5
          Hi Isomorphic team,

          could you identify the problem?

          best regards
          Burkhard

          Comment

          Working...
          X