Yes, problem solved.
The ‚edit‘ mode using a simple IKendoEditor implementation that renders a 
checkbox works well.

This can be done using standard PropertyColumn, i.e.:

new PropertyColumn("active", "active", 50) {
  override def isEditable = true
  override def getField = "active" // this is important, it's used below as 
'options.field' and is the path to the checkbox value in the model
  override def getEditor = new IKendoEditor {
  override def toString: String = {
    "function my-fun (container, options) { " // lf
      + "console.log(options);“
      + "jQuery('<input type=\"checkbox\" class=\"k-checkbox\" 
data-bind=\"checked: ' + options.field + '\"></input>')" // lf
      + ".appendTo(container); " // lf
      + „}"
  }
}

Then this only requires ‚onUpdate‘ implementation of the DataTable itself.


Regards,
Manfred



> Am 05.08.2024 um 18:57 schrieb Ernesto Reinaldo Barreiro <reier...@gmail.com>:
> 
> Thus, you solved your problem?
> 
> On Mon, Aug 5, 2024 at 10:26 AM Bergmann Manfred <m...@software-by-mabe.com>
> wrote:
> 
>> Having written this, I’ve looked a bit further and discovered the
>> ‚IKendoEditor‘ interface.
>> As used like here:
>> 
>> https://github.com/sebfz1/wicket-jquery-ui/blob/wicket9.x/wicket-kendo-ui/src/main/java/com/googlecode/wicket/kendo/ui/datatable/editor/TextAreaEditor.java
>> 
>> Seems like this should be used to modify model when in an ‚edit‘ mode.
>> 
>> 
>> Manfred
>> 
>> 
>>> Am 05.08.2024 um 17:00 schrieb Bergmann Manfred <m...@software-by-mabe.com
>>> :
>>> 
>>> 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 <
>> reier...@gmail.com>:
>>>> 
>>>> 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 <
>> m...@software-by-mabe.com>
>>>> 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: users-unsubscr...@wicket.apache.org
>>>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>>> 
>>>>> 
>>>> 
>>>> --
>>>> Regards - Ernesto Reinaldo Barreiro
>>> 
>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 
> 
> -- 
> Regards - Ernesto Reinaldo Barreiro


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to