PrimeNG Turbotable with custom comparator for one individual column?2019 Community Moderator ElectionPrimeNG Datatable - disable cell editing for specific rowsAngular 2 - custom data input in primeng listPrimeNG TurboTable sortable column sort indicator?PrimeNG Turbotable expand by defaultPrimeNG TurboTable scrolling columns with accordionPrimeNG TurboTable: Does dataKey need to be a column?primeng turbotable column auto-sizing with scrollingAutoLayout not working in PrimeNG TurboTablePrimeNG table with grouped columns won't sortHow to customize PrimeNG TurboTable paginator?

List elements digit difference sort

How can I ensure my trip to the UK will not have to be cancelled because of Brexit?

Reversed Sudoku

Reverse string, can I make it faster?

How did Alan Turing break the enigma code using the hint given by the lady in the bar?

Could you please stop shuffling the deck and play already?

Whose blood did Carol Danvers receive, Mar-vell's or Yon-Rogg's in the movie?

Find longest word in a string: are any of these algorithms good?

Why doesn't this Google Translate ad use the word "Translation" instead of "Translate"?

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Dropdown com clique

Motivation for Zeta Function of an Algebraic Variety

Do items de-spawn in Diablo?

What are the practical Opportunty Attack values for a bugbear, holding a reach weapon, with Polearm Mastery?

When a wind turbine does not produce enough electricity how does the power company compensate for the loss?

meaning and function of 幸 in "则幸分我一杯羹"

Do I really need to have a scientific explanation for my premise?

How does NOW work?

Is "history" a male-biased word ("his+story")?

Vocabulary for giving just numbers, not a full answer

Does "Until when" sound natural for native speakers?

When traveling to Europe from North America, do I need to purchase a different power strip?

Child Theme Path Being Ignored With wp_enqueue_scripts

Latex does not go to next line



PrimeNG Turbotable with custom comparator for one individual column?



2019 Community Moderator ElectionPrimeNG Datatable - disable cell editing for specific rowsAngular 2 - custom data input in primeng listPrimeNG TurboTable sortable column sort indicator?PrimeNG Turbotable expand by defaultPrimeNG TurboTable scrolling columns with accordionPrimeNG TurboTable: Does dataKey need to be a column?primeng turbotable column auto-sizing with scrollingAutoLayout not working in PrimeNG TurboTablePrimeNG table with grouped columns won't sortHow to customize PrimeNG TurboTable paginator?










1















We're having a pretty large table with lots of sorting and filtering options. The table is sortable by several columns, though only for one of them at a time. There's no combined sorting going on.



Now I am adding a field that contains a small widget instead of just text... Which understandably trips up the default comparator. So I'd like to provide one, but find myself unable to do so. All the info I find refer to providing a custom (sortFunction) for the entire table, while I only need one for one specific column.



To give you an idea what things look like, The table structure is built up like this:



<p-table [value]="items" ... >
<ng-template pTemplate="header">
<tr>
<th [pSortableColumn]="'condition'"> Condition
<p-sortIcon [field]="'condition'"></p-sortIcon>
</th>
<!-- other columns that look the same except for labels -->
</tr>
</ng-template>

<ng-template pTemplate="body" let-item>
<tr [pContextMenuRow]="item">
<!-- this is the specific column I need custom sorting for -->
<td><button type="button" pButton [label]="getConditionLabelFor(item)"
[ngClass]="getConditionClassFor(item)"></button>
</td>
<td>item.code</td>
<!-- more columns that look exactly like the last one -->
</tr>
</ng-template>
</p-table>



What I'm looking for is some means to pass a custom comparator to <th [pSortableColumn]="field" or something along those lines, not something that affects the entire table. Is this somehow possible?










share|improve this question




























    1















    We're having a pretty large table with lots of sorting and filtering options. The table is sortable by several columns, though only for one of them at a time. There's no combined sorting going on.



    Now I am adding a field that contains a small widget instead of just text... Which understandably trips up the default comparator. So I'd like to provide one, but find myself unable to do so. All the info I find refer to providing a custom (sortFunction) for the entire table, while I only need one for one specific column.



    To give you an idea what things look like, The table structure is built up like this:



    <p-table [value]="items" ... >
    <ng-template pTemplate="header">
    <tr>
    <th [pSortableColumn]="'condition'"> Condition
    <p-sortIcon [field]="'condition'"></p-sortIcon>
    </th>
    <!-- other columns that look the same except for labels -->
    </tr>
    </ng-template>

    <ng-template pTemplate="body" let-item>
    <tr [pContextMenuRow]="item">
    <!-- this is the specific column I need custom sorting for -->
    <td><button type="button" pButton [label]="getConditionLabelFor(item)"
    [ngClass]="getConditionClassFor(item)"></button>
    </td>
    <td>item.code</td>
    <!-- more columns that look exactly like the last one -->
    </tr>
    </ng-template>
    </p-table>



    What I'm looking for is some means to pass a custom comparator to <th [pSortableColumn]="field" or something along those lines, not something that affects the entire table. Is this somehow possible?










    share|improve this question


























      1












      1








      1








      We're having a pretty large table with lots of sorting and filtering options. The table is sortable by several columns, though only for one of them at a time. There's no combined sorting going on.



      Now I am adding a field that contains a small widget instead of just text... Which understandably trips up the default comparator. So I'd like to provide one, but find myself unable to do so. All the info I find refer to providing a custom (sortFunction) for the entire table, while I only need one for one specific column.



      To give you an idea what things look like, The table structure is built up like this:



      <p-table [value]="items" ... >
      <ng-template pTemplate="header">
      <tr>
      <th [pSortableColumn]="'condition'"> Condition
      <p-sortIcon [field]="'condition'"></p-sortIcon>
      </th>
      <!-- other columns that look the same except for labels -->
      </tr>
      </ng-template>

      <ng-template pTemplate="body" let-item>
      <tr [pContextMenuRow]="item">
      <!-- this is the specific column I need custom sorting for -->
      <td><button type="button" pButton [label]="getConditionLabelFor(item)"
      [ngClass]="getConditionClassFor(item)"></button>
      </td>
      <td>item.code</td>
      <!-- more columns that look exactly like the last one -->
      </tr>
      </ng-template>
      </p-table>



      What I'm looking for is some means to pass a custom comparator to <th [pSortableColumn]="field" or something along those lines, not something that affects the entire table. Is this somehow possible?










      share|improve this question
















      We're having a pretty large table with lots of sorting and filtering options. The table is sortable by several columns, though only for one of them at a time. There's no combined sorting going on.



      Now I am adding a field that contains a small widget instead of just text... Which understandably trips up the default comparator. So I'd like to provide one, but find myself unable to do so. All the info I find refer to providing a custom (sortFunction) for the entire table, while I only need one for one specific column.



      To give you an idea what things look like, The table structure is built up like this:



      <p-table [value]="items" ... >
      <ng-template pTemplate="header">
      <tr>
      <th [pSortableColumn]="'condition'"> Condition
      <p-sortIcon [field]="'condition'"></p-sortIcon>
      </th>
      <!-- other columns that look the same except for labels -->
      </tr>
      </ng-template>

      <ng-template pTemplate="body" let-item>
      <tr [pContextMenuRow]="item">
      <!-- this is the specific column I need custom sorting for -->
      <td><button type="button" pButton [label]="getConditionLabelFor(item)"
      [ngClass]="getConditionClassFor(item)"></button>
      </td>
      <td>item.code</td>
      <!-- more columns that look exactly like the last one -->
      </tr>
      </ng-template>
      </p-table>



      What I'm looking for is some means to pass a custom comparator to <th [pSortableColumn]="field" or something along those lines, not something that affects the entire table. Is this somehow possible?







      angular primeng primeng-turbotable






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 6 at 16:15







      UncleBob

















      asked Mar 6 at 15:22









      UncleBobUncleBob

      4471516




      4471516






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026539%2fprimeng-turbotable-with-custom-comparator-for-one-individual-column%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55026539%2fprimeng-turbotable-with-custom-comparator-for-one-individual-column%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко