85547

FlexiGrid “No Items”, response clearly shows data

Question:

Table is visible, looks fine, column headers show up, but after a split second of "processing, please wait..." the status goes to "No Items". Inspecting the response in the DOM shows the data is being returned properly from the web service, formatted as follows:

<?xml version="1.0" encoding="utf-8"?> <MyDataClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"> <Page>1</Page> <Rows> <MyDataRow> <request_id>13073</request_id> <status>501</status> <req_by_user_id>herbjm</req_by_user_id> </MyDataRow> ... .... </Rows> </MyDataClass>

Here is the flexigrid javascript in question:

$('#report').flexigrid({ url: 'reportdata.asmx/rptPendingServerRequestsFlexi', dataType: 'xml', colModel: [ { display: 'ID', name: 'request_id', width: 40, sortable: true, align: 'center' }, { display: 'Status', name: 'status', width: 180, sortable: true, align: 'left' }, { display: 'Requested By', name: 'req_by_user_id', width: 120, sortable: true, align: 'left' } ], searchitems: [ { display: 'ID', name: 'request_id' }, { display: 'Status', name: 'status', isdefault: true }, { display: 'Requested By', name: 'req_by_user_id' } ], sortname: "request_id", sortorder: "desc", usepager: false, title: 'Server Requests', useRp: false, rp: 30, showTableToggleBtn: false, singleSelect: true });

And for bonus points, how can I show the footer even if paging is diabled?

<strong>UPDATE:</strong> I inspected the DOM for the flexigrid demo and here is how their returned XML is formatted:

<?xml version="1.0" encoding="utf-8"?> <rows> <page>1</page> <total>239</total> <row id='1'> <cell>1</cell> <cell>501</cell> <cell>Steve</cell> </row> <row id='2'> <cell>2</cell> <cell>501</cell> <cell>Fred</cell> </row> </rows>

I'm guessing that's why it's not working? To see how I'm building the response, please see this question: <a href="https://stackoverflow.com/questions/14203171/vb-net-return-json-object-with-multiple-types/14205299#14205299" rel="nofollow">vb.net return json object with multiple types?</a>

Answer1:

According to various information I have found <a href="http://www.kenthouse.com/blog/2009/07/fun-with-flexigrids/" rel="nofollow">here</a> and a couple of other locations, flexigrid requires the XML to have specific format:

rows - the row definition page - the current page number total - the total count of rows in this collection row - the row, with a unique property called id cell - each row must contain cells in the order that they are displayed on the grid

Since the MyDataClass was generated as a result of <a href="https://stackoverflow.com/questions/14203171/vb-net-return-json-object-with-multiple-types/" rel="nofollow">your previous question</a>, here are updated versions of those classes that will produce the desired output:

<XmlType("rows")> _ Public Class MyDataClass <XmlElement("page")> _ Public Property Page As Integer <XmlElement("total")> _ Public ReadOnly Property Total As Integer Get If Me.Rows IsNot Nothing Then Return Me.Rows.Count Else Return 0 End If End Get End Property <XmlElement("row")> _ Public Property Rows As List(Of MyDataRow) ' Parameterless constructor to support serialization. Public Sub New() Me.Rows = New List(Of MyDataRow) End Sub Public Sub New(wPage As Integer, ds As DataSet) Me.New() Me.Page = wPage For Each oRow As DataRow In ds.Tables(0).Rows Dim oMyRow As New MyDataRow oMyRow.Id = CInt(oRow("id")) oMyRow.Name = CStr(oRow("Name")) Me.Rows.Add(oMyRow) Next End Sub End Class <XmlType("row")> _ Public Class MyDataRow <XmlAttribute("id")> _ Public Property Id As Integer Private m_cCells As List(Of MyDataCell) <XmlIgnore()> _ Public WriteOnly Property Name As String Set(value As String) Me.AddCell("Name", value) End Set End Property <XmlElement("cell")> _ Public ReadOnly Property Cells As List(Of MyDataCell) Get Return m_cCells End Get End Property ' Parameterless constructor to support serialization Public Sub New() m_cCells = New List(Of MyDataCell) End Sub Public Sub AddCell(sCellName As String, sCellValue As String) m_cCells.Add(New MyDataCell(sCellName, sCellValue)) End Sub End Class Public Class MyDataCell <XmlIgnore()> _ Public Property Name As String <XmlText()> _ Public Property Value As String ' Parameterless constructor to support serialization Public Sub New() End Sub Public Sub New(sCellName As String, sCellValue As String) Me.New() Me.Name = sCellName Me.Value = sCellValue End Sub End Class

Answer2:

Guys have a look of this demo of flexiuigrid

<a href="http://flexidemo.ranjitjena.com/" rel="nofollow">http://flexidemo.ranjitjena.com/</a>

Recommend

  • Refresh combobox list from other window, MVVM
  • RxSwift : BehaviorRelay in place of Variable usage
  • Entity Framework 5.0 Relationships
  • Javascript Keyup Search for Div Values
  • Ordering list with jQuery drag and drop
  • Ext JS, change grid column configs default values globally
  • sqlite3_wal_checkpoint_v2 always returns SQL_BUSY
  • How do one only submit click event (div), when using jquery live function?
  • TCPDF's getNumLines() is sometimes wrong
  • Play Framework nested form errors missing
  • Return null in boolean to checkbox state converter in XAML
  • IOS > Open URL in Safari with POST
  • A class implementing two different IObservables?
  • Ionic storage “get” returns null only on the second call within method
  • apply a javascript function to draggable copy
  • Symfony 2 error page response
  • Plotting densities in R
  • Upload file that is in the cpan database
  • How do I get the list of bad records that didn't load in Bigquery?
  • SQL Query - Table Joining Problems
  • Can't remove headers after they are sent
  • Update Google Maps traffic layer without page reloading
  • How to use JavaScript to determine whether a file exists in a directory?
  • Sort List of Strings By Version
  • Installing iPhone App to iPhone
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • How to show dropdown in excel using jrxml (jasper api)?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • JTable with a ScrollPane misbehaving
  • How to stop GridView from loading again when I press back button?
  • python draw pie shapes with colour filled
  • sending mail using smtp is too slow
  • Busy indicator not showing up in wpf window [duplicate]
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • How can I use `wmic` in a Windows PE script?