PrimeNG p-orderList disable multiple selection of items












1















I am using PrimeNG's p-orderList. By default, the metaKeySelection attribute is true which implies that a metaKey(ctrl key) is needed to be pressed to select multiple items. I was rather looking for a way to completely disable selection of multiple items. I should be able to select ONLY ONE item in the ordered list.
There is no metaKey attribute available for p-orderList. Can anyone help me with this?



<p-orderList [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>


PS: onSelectionChange($event) is triggered every time you select items from the ordered list. $event.value contains the array of the items.










share|improve this question




















  • 1





    Please correct your tagging! Read what all tags are and see which one you are actually not using

    – Kukeltje
    Nov 14 '18 at 9:34
















1















I am using PrimeNG's p-orderList. By default, the metaKeySelection attribute is true which implies that a metaKey(ctrl key) is needed to be pressed to select multiple items. I was rather looking for a way to completely disable selection of multiple items. I should be able to select ONLY ONE item in the ordered list.
There is no metaKey attribute available for p-orderList. Can anyone help me with this?



<p-orderList [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>


PS: onSelectionChange($event) is triggered every time you select items from the ordered list. $event.value contains the array of the items.










share|improve this question




















  • 1





    Please correct your tagging! Read what all tags are and see which one you are actually not using

    – Kukeltje
    Nov 14 '18 at 9:34














1












1








1








I am using PrimeNG's p-orderList. By default, the metaKeySelection attribute is true which implies that a metaKey(ctrl key) is needed to be pressed to select multiple items. I was rather looking for a way to completely disable selection of multiple items. I should be able to select ONLY ONE item in the ordered list.
There is no metaKey attribute available for p-orderList. Can anyone help me with this?



<p-orderList [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>


PS: onSelectionChange($event) is triggered every time you select items from the ordered list. $event.value contains the array of the items.










share|improve this question
















I am using PrimeNG's p-orderList. By default, the metaKeySelection attribute is true which implies that a metaKey(ctrl key) is needed to be pressed to select multiple items. I was rather looking for a way to completely disable selection of multiple items. I should be able to select ONLY ONE item in the ordered list.
There is no metaKey attribute available for p-orderList. Can anyone help me with this?



<p-orderList [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>


PS: onSelectionChange($event) is triggered every time you select items from the ordered list. $event.value contains the array of the items.







html angular primeng






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 7:59









Ashish Kamble

632519




632519










asked Nov 14 '18 at 6:23









Sourav PatraSourav Patra

63




63








  • 1





    Please correct your tagging! Read what all tags are and see which one you are actually not using

    – Kukeltje
    Nov 14 '18 at 9:34














  • 1





    Please correct your tagging! Read what all tags are and see which one you are actually not using

    – Kukeltje
    Nov 14 '18 at 9:34








1




1





Please correct your tagging! Read what all tags are and see which one you are actually not using

– Kukeltje
Nov 14 '18 at 9:34





Please correct your tagging! Read what all tags are and see which one you are actually not using

– Kukeltje
Nov 14 '18 at 9:34












1 Answer
1






active

oldest

votes


















0














What about the metaKeySelection input property? (as shown here)



<p-orderList [metaKeySelection]="false" [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>





share|improve this answer
























  • the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

    – Sourav Patra
    Nov 16 '18 at 10:50











  • Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

    – Dyd666
    Nov 17 '18 at 20:22











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%2f53294232%2fprimeng-p-orderlist-disable-multiple-selection-of-items%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














What about the metaKeySelection input property? (as shown here)



<p-orderList [metaKeySelection]="false" [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>





share|improve this answer
























  • the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

    – Sourav Patra
    Nov 16 '18 at 10:50











  • Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

    – Dyd666
    Nov 17 '18 at 20:22
















0














What about the metaKeySelection input property? (as shown here)



<p-orderList [metaKeySelection]="false" [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>





share|improve this answer
























  • the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

    – Sourav Patra
    Nov 16 '18 at 10:50











  • Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

    – Dyd666
    Nov 17 '18 at 20:22














0












0








0







What about the metaKeySelection input property? (as shown here)



<p-orderList [metaKeySelection]="false" [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>





share|improve this answer













What about the metaKeySelection input property? (as shown here)



<p-orderList [metaKeySelection]="false" [value]="policyList" [listStyle]="{'min-height':'calc(100vh - 325px)'}" (onSelectionChange)="onSelectionChange($event)">
<ng-template let-policy pTemplate="policy">
<span>{{policy}}</span>
</ng-template>
</p-orderList>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 8:12









Dyd666Dyd666

344316




344316













  • the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

    – Sourav Patra
    Nov 16 '18 at 10:50











  • Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

    – Dyd666
    Nov 17 '18 at 20:22



















  • the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

    – Sourav Patra
    Nov 16 '18 at 10:50











  • Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

    – Dyd666
    Nov 17 '18 at 20:22

















the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

– Sourav Patra
Nov 16 '18 at 10:50





the [metaKeySelection] just enables toggling of one or more elements. If its true (which is by default), you will be able to select one item BUT need ctrl key to select multiple items. If metaKeySelection is false, you can select multiple items by default. I want to avoid that itself.

– Sourav Patra
Nov 16 '18 at 10:50













Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

– Dyd666
Nov 17 '18 at 20:22





Mmm, i don't think you can achieve that, as you can see here: github.com/primefaces/primeng/blob/master/src/app/components/… orderlist handle ONLY multiple selection. You could try to extend the orderlist component and create your own one. stackoverflow.com/questions/44519015/…

– Dyd666
Nov 17 '18 at 20:22


















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%2f53294232%2fprimeng-p-orderlist-disable-multiple-selection-of-items%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

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python