Capturing checkbox selection event in prime dataTable - primeng

In the prime datatable I have a checkbox to select multiple rows. When I select or unselect the checkbox, all the rows get selected/unselected correctly. On selecting or unselecting the checkbox I want to disable few buttons at the top. Hence I need help in knowing the attribute to capture selection.
<p-dataTable>
<p-column selectionMode="multiple">
</p-column>
</p-dataTable>

use onRowSelect and onRowUnselect events
for example :
(onRowSelect)="updateSelected($event)" (onRowUnselect)="updateSelected($event)"

onHeaderCheckboxToggle did the trick.

Related

Grid Deselect Multiple Checkboxes with shift click

We are trying to get our react ag-grid checkbox functionality to work like gmail where if you shift click multiple checkboxes that are already selected it will deselect them (see screenshot below). The problem is during onRowSelected it will give me the rows that are already selected but I can't find the range that was selected. onSelectionChanged will get me the range selected but doesn't tell me the row that was just selected so that I can get the value to deselect the checkboxes. Anyone have any suggestions?

How mark selected item from the datatable PrimeNg?

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

extjs- checkboxgrid check boxs unselecting on clicking different column in grid

I am using checkboxmodel grid in extjs for display values.
after selecting multiple row checkboxs, if i click different column all selected checkbox are unselecting. how to stop this.
https://fiddle.sencha.com/#fiddle/18bj
Use checkOnly: true on the selection model:
True if rows can only be selected by clicking on the checkbox column,
not by clicking on the row itself. Note that this only refers to
selection via the UI, programmatic selection will still occur
regardless.
https://fiddle.sencha.com/#fiddle/18bo

How do I get checkbox unchecked from rowselection in an ExtJS grid?

I am using checkboxselectionmodel in ExtJS grid?
when i clicked on the row the row get selected and the respective checkbox also checked ..
But i need the checkbox to be checked only when i click the checkbox otherwise i want row
only get selected ...
Please help me out...
Thanks & Regards,
Ramanavel Selvaraju
In your CheckboxSelectionModel set checkOnly config option to true.
The CheckboxSelectionModel links row selection and checkbox selection. You want row selection to be independent from the checkbox - so use RowSelectionModel and add a Checkbox into the first column of your grid.

DataGridView column of type DataGridViewCheckBoxCell is constantly readonly/disabled

I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this:
DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell());
You see that I need a CheckBox cell template.
The problem I face is that this column is constantly readonly/disabled, as if it would be of TextBox type. It doesn't show a checkbox at all.
Any thoughts on how to work with editable checkbox columns for DataGridView?
Update: For windows forms, please.
Thanks.
Well, after more than 4 hours of debugging, I have found that the DataGridView row height was too small for the checkbox to be painted, so it was not displayed at all. I have found this after an accidental row height resizing.
As a solution, you can set the AutoSizeRowsMode to AllCells.
richDataGrid.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
Instead of trying to create the column in code, click on the tiny arrow in a box at the top right of the DataGridView control, and select "Edit Columns..." from the menu that appears. In the dialog box, click the Add button, then choose the "Databound column" option and pick the boolean column you're binding to.
Create a TemplateField and bound the id to it, something like this:
<asp:TemplateField HeaderText="Whatever" SortExpression="fieldname" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:CheckBox runat="server" ID="rowCheck" key='<%# Eval("id") %>' />
</ItemTemplate>
</asp:TemplateField>

Resources