Answered by:
Dispaly data in a webpart + Jquery

Question
-
Hi All,
How to get the data from a list & dispaly like a html table in the CE webpart using jQuery.
Please help me on this issue & let me know if you have any queries.
Regards,
Kumar.Thursday, April 9, 2015 12:08 PM
Answers
-
Hi,
Theoretically, the way to retrieve data from list or library is the same when using Client Object Model.
A possible reason why the code not works for both list and library is that the fields between custom list and library might be different and they haven't been taken into consideration in the code.
I suggest you divide your code into two parts: retrieving data and generating HTML table. Make sure that the data can be retrieved properly, then generate HTML table with the data. By doing this, it will be easier to composite the code which can meet your requirement.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Dennis Guo Monday, April 20, 2015 4:40 AM
- Marked as answer by Dennis Guo Monday, April 27, 2015 7:49 AM
Monday, April 13, 2015 12:58 AM
All replies
-
Hi,
Have below link for your reference.
Get Items from SharePoint List and display in SharePoint using Content Editor Web Part and HTML table
Jquery to display the list items in a content editor webpart
Querying SharePoint List data using REST services client-side
Thanks. Please mark it as an answer if it helps.
Thursday, April 9, 2015 2:35 PM -
Hi Jaydeep,
Thanks for your response. I am getting the error "Message: Object doesn't support this property or method" in the below line.
$(xData.responseXML).SPFilterNode("z:row").each(function()
Can you please help me on this issue!
Regards,
Kumar.
Friday, April 10, 2015 6:57 AM -
Hi,
I have tried the second link also, here I am not getting any error, but the below function not returning any rows.(I have uploaded 2 documents in the library)
$(xData.responseXML).find("z\\:row, row").each(function () {
Please Suggest.
Regards,
Kumar.
- Edited by KumarSP2013 Friday, April 10, 2015 7:54 AM
Friday, April 10, 2015 7:54 AM -
Hi,
A solution is that, you can query the columns of each item from this list using JavaScript Client Object Model, then generate a HTML table using JavaScript after that.
How to: Create, Update, and Delete List Items Using JavaScript
http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx
Common Programming Tasks in the JavaScript Object Model
http://msdn.microsoft.com/en-us/library/office/hh185015(v=office.14).aspx
About how to work with HTML table using jQuery:
http://www.htmlgoodies.com/beyond/css/working_w_tables_using_jquery.html
Thanks
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.Friday, April 10, 2015 8:34 AM -
Hi,
Surprisingly, the same code working for custom list but not for library. Any ideas!!
Regards,
Kumar.
Friday, April 10, 2015 11:37 AM -
Hi,
Theoretically, the way to retrieve data from list or library is the same when using Client Object Model.
A possible reason why the code not works for both list and library is that the fields between custom list and library might be different and they haven't been taken into consideration in the code.
I suggest you divide your code into two parts: retrieving data and generating HTML table. Make sure that the data can be retrieved properly, then generate HTML table with the data. By doing this, it will be easier to composite the code which can meet your requirement.
Thanks
Patrick Liang
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Dennis Guo Monday, April 20, 2015 4:40 AM
- Marked as answer by Dennis Guo Monday, April 27, 2015 7:49 AM
Monday, April 13, 2015 12:58 AM