.net - How to load data in Handsontable using Ajax JQuery? -


I am using the code below to load data from asp.net using jquery and ajax. But when this handset loads the load with only the array loaded with array data.

I have tried different ways with no luck. Please help me load data from server.

  function showGetResult () {$ .ajax ({type: "POST", url: "Input.aspx / LoadTable", contentType: "app / json; charset = utf-8" Data type: "json", success: function (res) {alert (res); $ ("# exampleGrid"). (Handheld data: res, rowHeaders: false, stretch H: all ', minspirio: 0, context Menu: True});}, Error: Function (Excerpt, Status) {Warning ("An error occurred:" + Status);}}); } & Lt; WebMethod () & gt; & Lt; ScriptMethod () & gt; _ Public Shared Function LoadTable () as String Dims dsCosts New DataSet as dsCosts = DataAccess.LoadTables Slim serializer (New) JavaScriptSerializer () New DataTable () 'As Dim DT' .... Forms of Data Get Data Data in String = GetJson (DT) Data Expiration Function Private Sharing Function GetJson (DT as DATTABLE) String Dim Serializer As New Rows of New JavaScriptSerializer As Rows (String, Objects) T in ()) () DT as Detar column string dim row as the words of object = nothing per line. Add to column row. (Col.ColumnName.Trim ()), Add Dr (line) ("Row Number", "R ||" and Row Line) Rows. Add (row) as the refresh string = serializer. Simplify (rows) rowCount + = 1 Return the next serializer. Celialis and Functions  

After struggling, I got the answer. Hope this helps others

You have to parse the data before binding it for hands

  $ Ajax ({type: "POST", url: "test.aspx / LoadTable", contentType: "application / json; charset = utf-8", datatype: "json", success: function {part = res. D; var data = JSON.parse (part); $ ('# dataTable'.) Handset ('load data', data);}, error: function (height, position) {warning ("an error occurred:" + status );}}); });  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -