Single selection

In single selection, the row is selected by a click event on a specific row. This selection is enabled by setting selectionMode as the single and selection property to hold the selected row. By default, the row is unselected with the help of the Meta key (Ctrl key for Windows or Command key for macOS). The row can be unselected without pressing the Meta key just by disabling the metaKeySelection property.

The component with a single selection feature to select a specific browser record would be written as follows:

<p-dataTable [value]="basicBrowsers" selectionMode="single"  
[(selection)]="selectedBrowser">
// Content goes here
</p-dataTable>

The component class has to define the selectedBrower object to store the selected item. The following screenshot shows a snapshot result with single selection as an example:

To notify that single selection has worked or not, we displayed the selected record information in a footer section. The footer data should always be in sync with the selected record.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.247.181