Announcement

Collapse
No announcement yet.

Using Bridge.Merge & Knockout - Runtime error

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using Bridge.Merge & Knockout - Runtime error

    After doing a merge of data from json with my class (generated from Bridge.NET)
    data = Bridge.merge(new Master(), data);
    then I try to
    self.CurrentEntity = ko.mapping.fromJS(data, { copy: self.myMetaData.ToCopyProperties });
    I get a runtime error:
    0x800a138d - JavaScript runtime error: String expected.

    Original message in Portuguese: Erro de runtime de JavaScript: Cadeia esperada.
    Cadeia translation can be: Chain? String? Object?

    Thanks,
    João Miguel

  • #2
    I'm using the mapping plugin. And the error is on the plugin...

    Thanks,
    João Miguel
    Last edited by joaommvsoares; 2017-09-13 @ 10:05 AM.

    Comment


    • #3
      I think I found the problem:
      I'm using (C#):
      private object[] myKeyValues;
      ...
      myKeyValues = new object[] { myKey };

      After Bridge.NET (.js);
      this.myKeyValues = System.Array.init([Bridge.box(this.myNumber, System.Int32)], System.Object);
      Problem with knockout mapping plugin

      Solution:
      Change change (C#) to
      myKeyValues = new string[] { myKey.ToString() };

      After Bridge.Net (.js)
      this.myKeyValues = System.Array.init([this.myNumber.toString()], System.String);
      No problem with knockout mapping plugin

      I still don't know if it will work like I intend to... But I'm trying!


      Comment

      Working...
      X