I have a datatable connect to DB table. this table has two columns, which is 1 or 0. I have choose checkbox to show this boolean value in the datatable. but the checkbox has been checked no matter the value is 1 or 0.
Please advise how to make the checkbox is checked only for the 1 value.
Solved! Go to Solution.
I came across the same issue @Xiangchen_2019 & @mdevaney . Every checkbox in the datatable was checked even when it should have been unchecked. I played with the functions and still didn't like the results. Then I accidentally deleted the Text field for the column and the checkboxes are filled accurately now.
So to get the checkboxes in the column to react correctly to a boolean value just remove the Text value for the column.
Yes, @JamesThurber is 100% correct. Select the column with the boolean values (where all checkboxes are shown as selected), then remove the formula within the text property of this column (mine was ThisItem.XY),
Then you achieve also displaying empty checkboxes.
(Maybe seen from a logical standpoint, the datatable only checks if there is a value, which is with regards to boolean always the case (true/false or yes/no are values vs. NULL, which is not a value).)
So after removing the formula it works as intended.
I just stumbled into this same problem. Select the column, and on the Text property you probably have a residual: ThisItem.'Has attachments'. This will trigger the checkbox to be selected all the time, no matter the font. Simple delete all the contents of the Text property, and the checkbox will work correctly
This is absolutely a bug! The solution proposed by @mdevaney is an elegant work around, at least for those who can use a font supporting his solution. Other users in this thread have proposed what I feel is the best correction/solution to the current bug. Simply leave the column's control type to Boolean and select the column and clear or comment out the Text property that it defaulted. This works exactly as you'd expect the control to work in the first place for Boolean columns.
Hopefully the team working on the Data Table control will fix this issue for Boolean control type columns, it seems simple enough.
Once fixed by clearing the Text property there still seems to be a slightly bizarre behavior but not one that seems to affect anything sever I can tell yet. Text columns show the text cursor and allow selecting the row by clicking where as the boolean column changes the cursor to an arrow. Clicking anywhere within the row highlights as normal and retains the look of the boolean column's checkbox however if you click on the checkbox itself it dims like its selected or something but there is no status change of the checkbox. Not sure what, if anything, the purpose of dimming the checkbox was meant for but hopefully, as the DataTable control evolves we will find out.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.