EnhancedHTML2 - Formatting the Order of Fragment Tables Non Alpha

This topic contains 6 replies, has 2 voices, and was last updated by  Chris Jones 10 months, 2 weeks ago.

  • Author
  • #79133

    Chris Jones

    Hello, I am currently converting a number HTML style reports to use the EnhancedHTML2 module, I really like the jQueryDataTableUri features, Is there a way to format the order that the columns appear from left to right in the Fragments or are they always sort Alphabetically. I have a number of fields that make sense to be next to each other. One option is to create expression labels so they sort but then that modifies the header of the fields.

  • #79141

    Don Jones

    If you run them through Select-Object first the properties should appear in whatever order you specify them.

    • #79151

      Chris Jones

      Hmm, I was attempting to create an array of all the html tables I want to convert to a EnhancedHTMLFragment and then pass them through a foreach to create all the fragments and thought the order was getting lost using a Get-Variable

      But then I simplified a test where I selected the order and passed that into the ConvertTo-EnhancedHTMLFragment
      what are the odds that I am using an older version of jQueryDataTableUri"

      what I was trying to do:

      foreach ($Table in $HTMLFragments|?{$_.HTMLBasename -eq "ContentDatabase"}|select table)
      $global:fragparams = @{'As'='Table';
      'PreContent'=$H21 + $table.table + $H22;
      set-variable -Scope global -name html_$Table -value (Get-Variable -Name $Table.table -ValueOnly|ConvertTo-EnhancedHTMLFragment @fragparams)

      This is a simplified EnhancedHTMLFragment I tried to see if I could get the column order displayed diferently.

      $html_ContentDB = $ContentDB|select Name,CurrentSiteCount,MaximumSiteCount,SiteCap,GBSizeRequired,Server,RBSProvider,RBSEnabled,WebApp,NeedsUpgrade,SortOrder|Sort WebApp,SortOrder|ConvertTo-EnhancedHTMLFragment @fragparams

  • #79153

    Don Jones

    So I'm possibly not understanding why you're enumerating your collection of fragments.

    As far as I know, the data table plugin doesn't reorder the columns. The order of the columns is determined when you create the fragment that contains the table.

    You can also specify the property list on the Convert command. You're saying that your second, simplified example did not retain the column order?

    • #79159

      Chris Jones

      Yes the second example didn't order the columns matching the select statement it order them alphabetically.

      For enumerating the collection of fragments, these aren't actually HTML fragments at this point. I have a number of arrays where I was using the out of the box convertto-html -as Table –Fragment.
      While I am converting to using the Enhanced HTML module, I was going to create an array of all the arrays that I want to have converted to approx. 2 dozen EnhancedHTMLFragments and try and pass those through a loop to create the HTML fragments.

  • #79162

    Don Jones


    Yeah, I dunno then. If you omit the data table stuff is the order correct? I won't be able to dig into it for a week or so but if you can diagnose that far it'll tell me where to dig.

    • #79165

      Chris Jones

      I am going to be off line out of the country for the next 2 weeks so you won't hear a reply from me for a few weeks on this topic. Thanks!

You must be logged in to reply to this topic.