Hello
I will try my best, but its not easy
1- how to assign javascript to the button onclick event
https://api.jquery.com/click/you have to use this form ("#id"),click(....
2- how to identify itemindex for the clicked button (how to add itemindex to event params)
This is even more complicated, this uses hidden inputs, you have to follow our code with examples. the method we use are
procedure GetInputControlNames(ANames: TStringList); override;
for rendering
and
procedure SetValueByName(const AName, AValue: string); override;
for server handling
and also, you have to use
.click on the li tags, in order to set these hidden inputs using the javascript function CGSetHiddenInputVal
this will mark an hidden input as dirty to be sent to the server
BTW: I notice in your MWSortableList.pas code this
With Result.Contents.AddTag('ol') do begin
AddStringParam('id', JQHTMLName);
this is wrong it will render repeated inputs, using at least someting like AddStringParam('id', 'ol_' + JQHTMLName);