How Do I Get Layout Xml from Client-side Javascript?

Posted by: trail-hacker on 3 August 2017, 3:54 pm EST

  • Posted 3 August 2017, 3:54 pm EST

    Is it possible to serialize the PivotViews' layout from inside Javascript? I'm doing this via a jquery hack right now where I simply find the control and call the click() method like so:
    <blockquote><font face="Courier New">$("#saveLayoutButton")click(function(){

      var layoutName = prompt('Enter a name for this layout:');
      if (layoutName == '')

      $("#</font><font face="Courier New">connectionKeyTextbox</font><font face="Courier New">").val('<%= Model.ConnectionKey %>');
      $("#buttonSave").click();<font color="#006400"><b> // jQuery hack! :(

    </b><font color="#000000">});</font></font></font>
    </blockquote>Now I've run into a situation where I need access the layouts' Xml via javascript. Currently, I'm forced to use the server-side Click() event trap, where <b>buttonSave </b>is defined with <b>runat="server"</b> like this:

    <blockquote><font face="Courier New">protected void buttonSave_Click(object sender, EventArgs e)
       var layout = new Layout(connectionKeyTextbox.Text);
       layout.Name = layoutNameTextbox.Text;
       layout.Xml = GetPivotViewXml();

    </blockquote>However, I need to be able to read the PivotViews' state in my javascript and post it to the server like this instead:
    <blockquote><font face="Courier New">$("#saveLayoutButton")click(function(){

      </font><font face="Courier New">var newLayout =
       ConnectionKey: '<%= Model.ConnectionKey %>',
       LayoutName: $('#layoutNameTextbox').val(),
       LayoutXml: <b>getPivotViewXml()</b> <b><font color="#006400">// What goes here? </font></b>

          alert("Your layout was saved.");     
          currentLayoutKey = data.LayoutKey;

    </font></blockquote>Is there any trick to get the the PivotViews' Xml from javascript?

    Thank you in advance for any help.
  • Replied 3 August 2017, 3:54 pm EST


    I would like to inform you that it is not possible to retrieve PivotView XML from via JavaScript. The layout can be retrieved only on the server side. We are planning to provide a Silverlight version of DataDynamics Analysis soon and then we can implement such functionality. Until then this is not possible with the current API.



Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels