I use the selectionMode = "multiple" option of datatable, How mark selected item from the database
Template:
<p-dataTable [value]="userLanguage" dataKey="key">
<p-column [style]="{'width':'38px'}" selectionMode="multiple"></p-column>
<p-column field="languageName" header="Idioma"></p-column>
<p-column field="languageId" header="Código"></p-column>
</p-dataTable>
selectionMode="multiple"
needs to go into your p-dataTable
line, not on the column. Also, you need to define what model you want to store your selected items, such as [(selection)]="selectedLanguages"
on the same line. To display certain items as selected, you need to add the languages to the selectedLanguages
array