<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Custom Sort in custom Visual Urgent in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3486843#M8139</link>
    <description>&lt;P&gt;Hello Developers!&lt;BR /&gt;&lt;BR /&gt;I am having many categorical data so I have to use the custom sort in my custom visual.&lt;BR /&gt;&lt;BR /&gt;I have followed the documentation :&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank"&gt;https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But the sorting options (menu) is not generated in the power bi so that i can change the order of each data fields as per my wish.&lt;BR /&gt;&lt;BR /&gt;I have implemented as follows:&lt;BR /&gt;&lt;STRONG&gt;Visual.ts:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import CustomVisualApplyCustomSortArgs = powerbi.extensibility.visual.CustomVisualApplyCustomSortArgs;

//In VisualUpdateOptions:

let queryName1 = datas.categorical.categories[0].source.queryName;
  console.log('queryname1',queryName1)
//output: Table.columnName
  let queryName2 = datas.categorical.categories[1].source.queryName;
  let args: CustomVisualApplyCustomSortArgs = {
      sortDescriptors: [
          {
              queryName: queryName1,
              sortDirection: powerbi.SortDirection.Ascending
          },
          {
              queryName: queryName2,
              sortDirection: powerbi.SortDirection.Ascending
          },
      ]
  };

this.host.applyCustomSort(args);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;capabilities.json:&lt;/STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"sorting": {

  "custom": {}

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also looked into the other custom visual open source. All of them are using implicit and default method.&lt;BR /&gt;&lt;BR /&gt;Thank You!&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2023 04:22:21 GMT</pubDate>
    <dc:creator>AakashMarasini</dc:creator>
    <dc:date>2023-10-20T04:22:21Z</dc:date>
    <item>
      <title>Custom Sort in custom Visual Urgent</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3486843#M8139</link>
      <description>&lt;P&gt;Hello Developers!&lt;BR /&gt;&lt;BR /&gt;I am having many categorical data so I have to use the custom sort in my custom visual.&lt;BR /&gt;&lt;BR /&gt;I have followed the documentation :&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank"&gt;https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;But the sorting options (menu) is not generated in the power bi so that i can change the order of each data fields as per my wish.&lt;BR /&gt;&lt;BR /&gt;I have implemented as follows:&lt;BR /&gt;&lt;STRONG&gt;Visual.ts:&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/sort-options" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import CustomVisualApplyCustomSortArgs = powerbi.extensibility.visual.CustomVisualApplyCustomSortArgs;

//In VisualUpdateOptions:

let queryName1 = datas.categorical.categories[0].source.queryName;
  console.log('queryname1',queryName1)
//output: Table.columnName
  let queryName2 = datas.categorical.categories[1].source.queryName;
  let args: CustomVisualApplyCustomSortArgs = {
      sortDescriptors: [
          {
              queryName: queryName1,
              sortDirection: powerbi.SortDirection.Ascending
          },
          {
              queryName: queryName2,
              sortDirection: powerbi.SortDirection.Ascending
          },
      ]
  };

this.host.applyCustomSort(args);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;BR /&gt;&lt;STRONG&gt;capabilities.json:&lt;/STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"sorting": {

  "custom": {}

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also looked into the other custom visual open source. All of them are using implicit and default method.&lt;BR /&gt;&lt;BR /&gt;Thank You!&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/17823"&gt;@v-viig&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 04:22:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3486843#M8139</guid>
      <dc:creator>AakashMarasini</dc:creator>
      <dc:date>2023-10-20T04:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Sort in custom Visual Urgent</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3486854#M8140</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/519176"&gt;@AakashMarasini&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't have any experience with the custom sorting API, but my understanding is that it will not add anything to the visual header, which is what default sorting is for. This custom API is intended for more complex scenarios than the visual header UX can manage, and I believe that it's something that the developer has to manage the display of (and add elements to manage the sorting operations for and drive this API) in their visual DOM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 04:35:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3486854#M8140</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2023-10-20T04:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Sort in custom Visual Urgent</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3489557#M8172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Thank you for your response. I thought I should use the custom API to have sort options for multiple data fields. If I cannot add a sort option to the visual header using the custom API, how could i achieve this feature?&lt;BR /&gt;With the default sort, sort options are not available for all my data roles. It is available for only two data fields: one categorical and one measure respectively in my case.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have used as:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;"sorting": {&lt;/STRONG&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; "default": {&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp; }&lt;/STRONG&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Aakash&lt;/P&gt;</description>
      <pubDate>Sun, 22 Oct 2023 06:27:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Custom-Sort-in-custom-Visual-Urgent/m-p/3489557#M8172</guid>
      <dc:creator>AakashMarasini</dc:creator>
      <dc:date>2023-10-22T06:27:57Z</dc:date>
    </item>
  </channel>
</rss>

