Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The flexgrid plugin is quite sparse on doumentation however in a small section on the demo page there is a tut on creating a json serialized object, this is a bit misleading because the grid requires a specific format, I have ported the php code for xml option with a little monkey grease you can do the same for the json formatting</p> <p>heres my xml port</p> <pre><code>the setup for the grid $("#tableToFlex").flexigrid({ url: 'WebService.asmx/getData'} ... *other configs* ...); </code></pre> <p>please consider the following code in the webservice.asmx class</p> <pre><code>&lt;WebMethod()&gt; _ &lt;ScriptMethod(ResponseFormat:=ResponseFormat.Xml)&gt; _ Public Function getData(ByVal page As Integer, _ ByVal qtype As String, _ ByVal Query As String, _ ByVal rp As Integer, _ ByVal sortname As String, _ ByVal sortorder As String) As System.Xml.XmlDocument 'note these parameters are inputted to determine paging and constrains for the resultant rows 'Sample list to send to the grid Dim list = New List(Of ApplicationStateInformation) 'Sample row object that holds name , surname , address, idnumber ... list.Add(New RowObjects( "test1", "test1", "test1", "12345")) list.Add(New RowObjects( "test2", "test2", "test2", "12345")) list.Add(New RowObjects( "test3", "test3", "test3", "12345")) list.Add(New RowObjects( "test4", "test4", "test4", "12345")) 'retun a xml doc, as we are using the xml format on the flexgrid Dim returnDoc = New System.Xml.XmlDocument() returnDoc.Load(New IO.StringReader(ToXmlResult(list))) Return returnDoc End Function Private Function ToXmlResult(ByVal list As List(Of RowObjects)) As String 'this is the xml document format the grid understands Dim result As String = "&lt;?xml version=""1.0"" encoding=""utf-8""?&gt;" &amp; vbCrLf result += "&lt;rows&gt;" &amp; vbCrLf result += String.Format("&lt;page&gt;{0}&lt;/page&gt;" &amp; vbCrLf, "1") result += String.Format("&lt;total&gt;{0}&lt;/total&gt;" &amp; vbCrLf, "10") For Each item In list result += ConvertRowData(item) Next result += "&lt;/rows&gt;" &amp; vbCrLf Return result End Function Private Function ConvertRowData(ByVal row As RowObjects) As String Dim result As String = String.Format("&lt;row id='{0}'&gt;" &amp; vbCrLf, row.IdNumber.ToString) 'THESE SHOULD BE HTML ENCODED (the format arg) but I left it out result += String.Format("&lt;cell&gt;&lt;![CDATA[{0}]]&gt;&lt;/cell&gt;" &amp; vbCrLf, row.Name) result += String.Format("&lt;cell&gt;&lt;![CDATA[{0}]]&gt;&lt;/cell&gt;" &amp; vbCrLf, row.Surname) result += String.Format("&lt;cell&gt;&lt;![CDATA[{0}]]&gt;&lt;/cell&gt;" &amp; vbCrLf, row.IdNumber) result += "&lt;/row&gt;" &amp; vbCrLf Return result End Function </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload