Announcement

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

    SC: 8.2 value parameter in changed event of list grid field with data source is empty

    Hi,

    in an editable list grid field of the type ComboBoxItem with a datasource is the selected object in a custom changed function always undefined.

    This has worked with SC 8, and does also not work with the last nightly build from 16th December.

    Interestingly, in an editable list grid field of the type ComboBoxItem with a local value map the selected object is shown as expected:

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true, 
        canEdit:true, editEvent:"click", modalEditing:true,
        data: countryData,
        fields:[
            {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png", canEdit:false},
            {name:"countryName", title:"Country"},
            {name:"continent", 
                title:"Continent",
                valueMap:["Europe", "Asia", "North America", "Australia/Oceania", "South America", "Africa"], 
            changed: function (form,item,value) {alert (value)}
            }
        ]
    })
    The same code above with a data source for continents always shows an undefined object when selecting the continent.

    Regards Thomas

    #2
    We must be misunderstanding this report as we're not reproducing the issue. If we take the attached code and modify it to fetch data from "countryDS" (in the "Databinding > Lists > Local DataSource" example), we don't see any issue -- the "value" parameter is correctly populated.
    Can you show us code that fails and give us exact steps to reproduce the error

    Comment


      #3
      Hi,

      here is the code with two data sources. The problem is in the second named “continentDataSource”. When selecting a continent in the editor grid the selected continent is always undefined. Code tested wit SC 8.2. snapshot 17 January 2012.

      Code:
      isc.ListGrid.create({
          ID: "countryList",
          width:500,
          height:224,
          alternateRecordStyles:true,
          canEdit:true,
          editEvent:"click",
          autoFetchData: true,
          modalEditing:true,
          dataSource: isc.DataSource.create({
              ID: 'countryDataSource',
              dataFormat:"json",
              dataURL:"/country.txt",
              fields:[
              {
                  name:"countryName",
              title:"Country"},
              {
                  name:"continent",
                  displayField:"name",
                  title:"Continent",
                  canEdit:true,
                  editorType:"ComboBoxItem",
                  optionDataSource:isc.DataSource.create( {
                      ID: 'continentDataSource',
                      "fields":
                      [
                      {
                          name:"number",
                          primaryKey:true
                      },
                      {
                          name:"name"
                      }
                      ],
                      "dataFormat":"json",
                      "dataURL":"/continent.txt",
                  }),
                  changed: function (form,item,value) {alert ("Selected value: " + value)}
              }
              ]
          })
      })

      country.txt
      Code:
      [
      
      {
          "continent":"North America",
          "countryName":"United States",
          "countryCode":"US",
          "area":9631420,
          "population":298444215,
          "gdp":12360000,
          "independence":"1776-07-04",
          "government":"federal republic",
          "government_desc":2,
          "capital":"Washington, DC",
          "member_g8":true,
          "article":"http://en.wikipedia.org/wiki/United_states"
      },
      {
          "continent":"Asia",
          "countryName":"China",
          "countryCode":"CH",
          "area":9596960,
          "population":1313973713,
          "gdp":8859000,
          "government":"Communist state",
          "government_desc":0,
          "capital":"Beijing",
          "member_g8":false,
          "article":"http://en.wikipedia.org/wiki/China"
      }
      ]

      continent.txt
      Code:
      [
        {name: "Europe", number: "1"},
        {name: "Asia", number: "2"},
        {name: "North America", number: "3"},
        {name: "Australia/Oceania", number: "4"},
        {name: "South America", number: "5"},
        {name: "Africa", number: "6"}
      ]
      Greetings Thomas

      Comment


        #4
        Hi Thomas
        The problem is that you have not specified a "valueField" for the continent field. This is the field on the option dataSource you want to extract values from.
        It therefore attempts to use the field name ("continent") as the value field, but of course for the optionDataSource records, record.continent is always undefined.
        You can solve this by specifying valueField:"name" on the field in question

        Thanks
        Isomorphic Software

        Comment


          #5
          Thank you very much! That has worked.

          Regards Thomas

          Comment

          Working...
          X