Developer forum

Forum » Swift » Multiple Datalists on same Page, error when sorting one of them

Multiple Datalists on same Page, error when sorting one of them

Pedro Meias
Pedro Meias
Reply

Hi,

DW 9.17.2, Swift 1.26.0

We have a scenario were we have a page with multiple Datalists, structure as follows

Datalists A and B do not have the same columns.

Paragraph with Datalist B will output a table with sortable columns. then when we try to sort one of the columns, All paragraphs using Datalist A will trow the following error.

 

An error occurred while attaching module (Dynamicweb.Frontend.Content)

 

System.IndexOutOfRangeException: Cannot find column FK_VIN_VIN.
   at System.Data.DataTable.ParseSortString(String sortString)
   at System.Data.DataView.set_Sort(String value)
   at Dynamicweb.DataManagement.PublishingRenderer.SortTable(DataTable viewTable)
   at Dynamicweb.DataManagement.PublishingRenderer.RenderRows(Publishing publishing, Template template)
   at Dynamicweb.DataManagement.PublishingRenderer.RenderPublishing(Publishing publishing, Template template)
   at Dynamicweb.DataManagement.PublishingFrontend.RenderPublishing(String result)
   at Dynamicweb.DataManagement.PublishingFrontend.GetContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)

 

A possible fix would be to check the paragraphId on the request is the same paragraph Id on the datalist when SortTable is called.

private void SortTable(DataTable viewTable)
        {
            string sortBy = Context.Current.Request["SortBy"];
            string sortOrder = Context.Current.Request["SortOrder"];            if (sortBy != string.Empty && (sortOrder == "ASC" || sortOrder == "DESC"))
            {
                viewTable.DefaultView.Sort = string.Format("{0} {1}", sortBy, sortOrder);
            }
        }

Here is a url for the test scenario https://dev-krvc.mydwsite5.com/service-campaigns/service-campaign-details?ServiceCampaignId=23

Let me know if you need any more information.

Thank you


Replies

 
Merethe Vrå Andersen Dynamicweb Employee
Merethe Vrå Andersen
Reply

Hi, 

Swift hasn't default templates for data lists, but it's the built in template from Dynamicweb that seems to have an issue. I have reproduced the error and created a bug for the Dynamicweb backend team. Thanks you for reporting it.
Bug 18839.

Kind regards,
Merethe Vrå Andersen

 

You must be logged in to post in the forum