I inserted javascript code in a Sharepoint 2013 wikipage, through Embed Code.

The basic javascript code appends rows to a table, the code is

var myTable= document.getElementById('myTable');
myTable.innerHTML += myRecord;

Where variable myRecord contains the html code for the row to be appended, the html code is something like

<tr><td>my cell</td><td>my cell 2</td></tr>

The code works as expected and appends the rows to the table 'myTable'.

But when I hit refresh to reload the SharePoint 2013 wikipage, all the rows added programmatically through the javascript are gone

Kindly suggest how to dynamically add HTML content and make it persistent, so the dynamic HTML content don't disappear on page reloads. I know I could save it in local storage and retrieve it or try cookies or session, but its not feasible because the table will have a couple of thousand records or much more.

So I just want to ensure whatever changes I do to the Sharepoint 2013 wikipage's HTML code, through javascript, remain saved or persistent.

Was able to replicate save button using CoreInvoke('PageActionClick', this), but the save button default functionality toggles between save and edit, I only want the save functionality.

Some references I found online


Assign "Edit" fuctionality to a custom button

  • SharePoint got a table-like persistent storage called Lists, perhaps you could use that? – eirikb Aug 9 '15 at 7:42
  • @eirikb Could you suggest how to change the label of "add new item" in the Access lists for sharepoint 2013? I found the suggestion in social.technet.microsoft.com/forums/sharepoint/en-US/… However I don't know how to add the content editor web part in the lists, I also currently don't have access to sharepoint designer. – joel Aug 11 '15 at 2:39
  • @eirikb I now have access to sharepoint designer 2013 and am able to see the sharepoint site on my sharepoint designer, but am unable to find the correct file to edit the label code, kindly guide me – joel Aug 11 '15 at 3:46
  • What I had in mind was that you kept your wiki page, but for the data you could use a list. Then for the table data I would use REST to fetch the data and present it the way you like – eirikb Aug 11 '15 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.