Quantcast
Channel: jQuery Library for SharePoint Web Services
Viewing all articles
Browse latest Browse all 6517

New Post: Table rows not being rendered

$
0
0
LOL
"I wish client side development would just go away" might not be the best comment when you are trying to get help on client side coding from a community of folks that may actually like client side coding. :)

Although you may be a C# developer, you have managed to hack together some pieces of code to generate HTML. You are not far off... jQuery .each() is a looping function (similar to C# foreach) and thus if you are generating a <Table> tag inside the loop you are going to get as many tables as there are iterations through the loop.

I think you are trying to loop through all document libraries and then for each one you want to show a table with the list of files along with some file information for each... So your code design (yes, do that too in client side development) would be
  1. initiate the variable that will store the html markup
  2. Get List of Document Libraries.
  3. Loop through each Document library and for each one, do the following (in this order):
    a. Add the name of the list to the variable that is storing the HTML (From Step 1) - example: <h3>list Name</h3>
    b. Add the Table markup and header row to the variable that is holding the html markup (<table><tr><th>column1</th><th>colomn2</th></tr>)
    c. Get a list of all files from this document library
    d. Loop through the list of files and append the rows to the variable holding the html markup (<tr><td>column1 values</td><td>column2 value</td></tr>) to content you generated in step 2.b.
    e. Close the table markup that was started in 2.b (</table>).
  4. When we are all done with looping through all document libraries (#4) and getting all files for each document library (4.d), add the html markup to the page ($("#myDiv").append(something)
Looking at your code, and with this information you should be able to fix it up... remember that in Javascript, variable are scoped only within functions, so you probably want to define your html markup variable at the very top of the program.

Hope this helps... Good luck

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>