Announcement

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

    Problem with & symbol in selectitem

    Hi ,
    I have a selectItem in my screen for which the data is fetched from database.
    Now one of the value comes as "A&F" from the database.I am able to see this value in the picklist ,but when i select this item ,my selectitem is showing only A.
    This is not the case with other special characters.
    Please let me know how to solve this issue.

    Thanks,
    Keerthi.

    #2
    Hi,
    Any updates on how to solve this issue.
    This is kind of urgent.
    Please help me to solve this issue.

    Thanks,
    Keerthi

    Comment


      #3
      Hi Keerthi,
      For now the best way to do this is to implement an undocumented method mapValueToDisplay() to escape the "&" character.
      Something like this:
      Code:
      {name:"foo", type:"select",
       mapValueToDisplay : function (dataValue) {
          if (isc.isA.String(dataValue)) {
            dataValue.replace(/&/g, "&")
          }
          return this.Super("mapValueToDisplay", [dataValue]);
       }
      This is an undocumented API, and as such we can't guarantee it won't be modified or renamed in a future release. However if we do modify this function we will be sure to update this thread to notify you, and let you know how else to achieve the equivalent functionality.

      Thanks
      Isomorphic Software

      Comment


        #4
        Hi Keerthi,

        Another way is to replace "&" to "&" when you fetch the data from server.

        You can use regex function to find and replace the symbol for each record.

        Comment


          #5
          For the benefit of people who discover this thread while searching the forums:

          As of version 10.1 (SmartGWT 5.1), the mapValueToDisplay() and mapDisplayToValue() methods have been made public. However, they are intended as callable APIs only, not as override points, so the suggestion we make in this very old thread is invalid. See the mapValueToDisplay() and mapDisplayToValue() documentation for supported alternative methods of formatting and parsing FormItem values. In this case, since the item in question is a SelectItem, the appropriate thing to do would be to implement formatValue(), and apply the conversion from "&" to "&" in there

          Comment

          Working...
          X