0

I am using primeng datatable

<p-dataTable [value]="cars" reorderableColumns="true">
  <p-column field="vin" header="Vin"></p-column>
  <p-column field="year" header="Year"></p-column>
  <p-column field="brand" header="Brand"></p-column>
  <p-column field="color" header="Color"></p-column>
</p-dataTable>

In above code, I don't want to allow reordering to column "color".(Want to set reorderableColumns="false" to "color" column).

Anyone having any solution??

2 Answers 2

1

Currently there is no support of selected column ordering in primeng datatable. A callback onColReorder() is provided by primeng that only invoke after the completion of ordering.

If you want to achieve this kind of functionality then you can try the following patch code.

<div style="width:75%;float:left">
    <p-dataTable [value]="cars" reorderableColumns="true">
        <p-column field="vin" header="Vin"></p-column>
        <p-column field="year" header="Year"></p-column>
        <p-column field="brand" header="Brand"></p-column>
    </p-dataTable>
</div>
<div style="width:25%;float:left">
    <p-dataTable [value]="cars">
        <p-column field="color" header="Color"></p-column>
    </p-dataTable>
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

New p-table aka TurboTable has this easy by adding pReorderableColumn to the columns that you want.
0

Try using pReorderableColumnDisabled attribute to what ever column you dont want to reorder.

<p-dataTable [value]="cars" reorderableColumns="true">
     <p-column field="vin" header="Vin"></p-column>
     <p-column field="year" header="Year"></p-column>
     <p-column field="brand" header="Brand"></p-column>
     <p-column field="color" header="Color" [pReorderableColumnDisabled]="true"></p-column>
</p-dataTable>

Happy Coding :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.