jQWidgets Forums
jQuery UI Widgets › Forums › DataTable › DataTable is only showing the first result
This topic contains 2 replies, has 2 voices, and was last updated by MatthewV 8 years, 9 months ago.
-
Author
-
After upgrading to the latest version of jqWidgets I was able to get the DataTable to show my data, kind of. I have a json result with 7 entries but the table is only showing the first.
JSON:
[{"ID":0,"ProjectCode":"CSSI0100009","ProjectDescription":"C Squared Company Overhead","TaskCode":"INTMEETNG","TaskDescription":"Internal-Meetings","StartDateTime":"\/Date(1471838400000)\/","HoursWorked":2.00,"WorkDescription":"Company meeting.","WeekdayName":"1"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTPROGRA","TaskDescription":"Internal Software Programming","StartDateTime":"\/Date(1471838400000)\/","HoursWorked":4.00,"WorkDescription":"Payroll processing support/","WeekdayName":"1"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTINFTEC","TaskDescription":"Internal IT","StartDateTime":"\/Date(1471838400000)\/","HoursWorked":2.00,"WorkDescription":"Dynamics meeting and problem followups","WeekdayName":"1"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTINFTEC","TaskDescription":"Internal IT","StartDateTime":"\/Date(1471924800000)\/","HoursWorked":7.00,"WorkDescription":"Dynamics testing, security research, dealing with Admiral","WeekdayName":"2"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTPROGRA","TaskDescription":"Internal Software Programming","StartDateTime":"\/Date(1471924800000)\/","HoursWorked":1.00,"WorkDescription":"JobSight testing and DB investigation","WeekdayName":"2"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTPROGRA","TaskDescription":"Internal Software Programming","StartDateTime":"\/Date(1472011200000)\/","HoursWorked":8.00,"WorkDescription":"Timesheets","WeekdayName":"3"},{"ID":0,"ProjectCode":"CSSI0100002","ProjectDescription":"In-Building - NH Overhead","TaskCode":"INTINFTEC","TaskDescription":"Internal IT","StartDateTime":"\/Date(1472097600000)\/","HoursWorked":3.00,"WorkDescription":"Dynamics Training.","WeekdayName":"4"}]
jqWidget Code:
<script type="text/javascript"> $(document).ready(function () { var url = "/Timesheet/TimesheetWeeklyOverview"; var source = { dataType: "json", dataFields: [ { name: 'HoursWorked', type: 'number' }, { name: 'ProjectCode', type: 'string' }, { name: 'ProjectDescription', type: 'string' }, { name: 'TaskCode', type: 'string' }, { name: 'TaskDescription', type: 'string' }, { name: 'WeekdayName', type: 'string' }, { name: 'WorkDescription', type: 'string' } ], id: 'ID', url: url }; var dataAdapter = new $.jqx.dataAdapter(source); $("#TimesheetWeeklyOverview").jqxDataTable( { width: 850, pagerButtonsCount: 10, source: dataAdapter, columnsResize: true, columns: [ { text: 'Project Code', dataField: 'ProjectCode' }, { text: 'Project Description', dataField: 'ProjectDescription' }, { text: 'Task Code', dataField: 'TaskCode' }, { text: 'Task Description', dataField: 'TaskDescription' }, { text: 'Day Worked', dataField: 'WeekdayName' }, { text: 'Hours Worked', dataField: 'HoursWorked' }, { text: 'Work Description', dataField: 'WorkDescription' } ] }); }); </script>
Any ideas why this might be?
Hi MatthewV,
This is happening because all of your objects have
ID : 0
. Make all ID’s unique.Best Regards,
IvojQWidgets Team
http://www.jqwidgets.com/Thanks, I was thinking that as I posted but did not have time last night to test it so I thought I would just hit submit incause it was wrong. I added unique IDs and it is working now.
-
AuthorPosts
You must be logged in to reply to this topic.