Changing ThreadID dynamically

Home Forums Comment box for SharePoint Changing ThreadID dynamically

Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #10477
      kman3d
      Participant

        Hello Alex,
        I’m trying to figure out what is the best way to accomplish this:
        I have a page consisted out of an iFrame and a link Bar. Clicking on each Link updates the src of the iFrame. I do this with some JS function.
        What I want is to have the Comments box to show a different Thread for a each link I click.

        ex: Click on a link “Section A” will display “http://some address/A” in Iframe and will display all comments of thread “Section_A”.
        (I couldn’t figure out how to update the cBoxArg Configuration object, maybe JQuery?)

        Thanks!

        • This topic was modified 8 years, 9 months ago by kman3d.
      • #10528
        Alexander Bautz
        Keymaster

          I’m not sure I understand, but updating an object is just like this:

          cBoxArg.ThePropertyYouWantToChange = "the new value";

          Alexander

        • #10575
          kman3d
          Participant

            O.k,but after I update the object, how do I reload the comments instance?
            Also,is this object is global? (can i update it from another script in a different CEWP?)

            • This reply was modified 8 years, 9 months ago by kman3d.
          • #10619
            Alexander Bautz
            Keymaster

              Hi,
              There is no built in method to “kill” the current cBox instance to rewrite it, but you should be able to use this code:

              // Clear existing cBox
              $("*[id*=commentBoxInstanse_1").html("");
              // Change the placeholderID and threadID
              cBoxArg.placeholderID = "commentBoxInstanse_2";
              cBoxArg.threadID = "commentBoxInstanse_2"+cBoxArg.threadID.split(":")[1];
              // reset data object
              spjs.cBox.data.commentCount = {};
              spjs.cBox.data.currDatasetIDArr = {};
              spjs.cBox.data.currDatasetLastID = [];
              spjs.cBox.data.itemData = {};
              spjs.cBox.data.settingsObj = {};
              // Call function
              spjs.cBox.init(cBoxArg);

              Note the placeholderID “commentBoxInstanse_1” which is the default one, which is changed to “commentBoxInstanse_2”. This means you must have a placeholder for each of the cBox instances on the page.

              Hope this helps,
              Alexander

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.