Quickstart is difficult because it means a considerable additional effort.
But I’ve added a screenshot.
The right-most column is a CommandColumn with CommandButtons. This works well,
onClick handler is called, all good.
The columns with the checkboxes here are customized CommandColumns with
CommandButton.
The CommandColumns override getTemplate with something like this:
override def getTemplate: String = {
s"""<label class="checkbox-toggle">
| <input role="button" type="checkbox" href="javascript:;"
title="activeCheckbox" class="k-button w-icon-only" if($getField){#
${checkboxAttributes.positiveClass} #} else
{#${checkboxAttributes.negativeClass}#}#/><span class="control"></span>
|</label>""".stripMargin
}
So this basically renders an checkbox form component. I honestly doubt this is
the right approach.
With this the CommandButton's onClick handler doesn’t work, only the
DataTable's onClick handler fires, but the Checkbox doesn’t toggle.
Probably this requires attaching a custom JavaScript to make that happen. But
that seems like a complex way to make this happen.
I’d think that the ’selectable’ approach using a CheckboxColumn is probably the
right thing here.
But we can’t figure out how to achieve that a checkbox toggle immediate fires a
callback.
Regards,
Manfred
> Am 02.08.2024 um 22:54 schrieb Ernesto Reinaldo Barreiro <[email protected]>:
>
> Could you please share some more data? Maybe share a quickstart project
> illustrating what you want to do?
>
> On Fri, Aug 2, 2024 at 11:57 AM Bergmann Manfred <[email protected]>
> wrote:
>
>> Hello.
>>
>> We’re struggling to add (or actually we’re not sure of possible ways)
>> checkboxes to a DataTable (Grid) column that will install onClick handler
>> similar as the CommandButtons do in CommandColumn, so that onClick is
>> called on each checkbox toggle.
>> We’re tried a few variations, i.e. using AbstractColumn with CommandButton
>> and use getTemplate to render checkbox form input, but this doesn’t install
>> an onClick handler, or at least onClick is not called.
>>
>> Anyone with pointers of how this could work?
>>
>>
>> Regards,
>> Manfred
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
> --
> Regards - Ernesto Reinaldo Barreiro
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]