Announcement

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

    special characters in editable table

    I have the following issue - not sure if it is desired behaviour:

    I have an editable table in which I have provided a display field. The display field escapes the special character that I have in the string. The actual value contains the special character unescaped. Click into the first row's Country Name - I am expecting it to show the countryName VALUE but it shows the displayField value - Could you please tell me what I am missing?

    Code:
    countryData = [
    
    {
        countryCode:"US",
    c$df:"Umlauts: ü",
    countryName: "Umlauts: ü",    population:298444215
    },
    {
        countryCode:"CH",
        countryName:"China",
        population:1313973713
    },
    {
        countryCode:"JA",
        countryName:"Japan",
        population:127463611
    }];
    
    isc.ListGrid.create({
        autoDraw: false,
        ID: "countryList",
        height:30,
        width:500, alternateRecordStyles:true, 
        autoFitMaxRecords: 5,
        autoFitData: "vertical",
        data: countryData,
        canEdit: true,
        editEvent: "click",
        listEndEditAction: "next",
        enterKeyEditAction: "nextRowStart",
        fields: [
            {name: "countryCode", title: "Country Code"},
            {name: "countryName", title: "Country Name", displayField:"c$df", _constructor:"TextItem"},
            {name: "population", title: "Population"}
        ]
    })
    
    isc.IButton.create({
        ID: "button",
        autoDraw: false,
        title:"Edit New",
        click:"countryList.startEditingNew()"
    });
    
    isc.VStack.create({
        membersMargin: 10,
        members: [
            countryList, button
        ]
    });

    #2
    Hi - have you had a chance to look at this post yet?

    Comment


      #3
      Hi
      Yes - this actually appears to be behaving as expected. Two things are happening here:

      Firstly - We are showing the display field value in both static and editable mode. That's expected - consider a case where you have a user-visible value such as "Severity" ratings (Critical, Severe, Cosmetic), which maps to an underlying numeric data value.
      In both static, and edit mode, the user would be shown the display-field value.
      You can make this more obvious by modifying the display-value to be more different from the data value by the way.

      Secondly - while not in edit mode, the special character &uumml; is being rendered out as standard HTML and interpreted, so you see the umlaut'd "u" character.
      As an aside - you can suppress this behavior by setting 'escapeHTML' to true on the field.
      In the edit-mode scenario, the value is assigned to the "value" attribute of an input element directly, so the user sees the raw character code rather than the interpreted special character.

      Hopefully this helps clarify things. Please let us know if you have further questions in this area

      Thanks
      Isomorphic Software

      Comment

      Working...
      X