CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

how to add a button inside list item ??

by fateh78 » 20 Dec 2017 10:20

how to add a button inside list item ??
what is the best way to do that ?
i inherited a new class from TIWCGJQSortableList and changed GetHtmlTag procedure to produce a button inside the item
now how to assign onclick event to the button ??
You do not have the required permissions to view the files attached to this post.
fateh78
 
Posts: 85
Joined: 16 Mar 2017 21:45

by Jorge Sousa » 20 Dec 2017 17:58

Hi Fateh

If you have CGDevTools source code look for examples of CGRegisterCallBack (and CGUnregisterCallback)
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fateh78 » 21 Dec 2017 01:21

how can identify the clicked item ?
fateh78
 
Posts: 85
Joined: 16 Mar 2017 21:45

by Jorge Sousa » 21 Dec 2017 11:14

Send us what you have by email and we will tell you, it's very hard to answer these kind of questions without seeing any code, i hope you understand
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fateh78 » 21 Dec 2017 20:02

Dear Sousa

find attached demo

thanks in advance

note : the attached project contains demonstration for other 2 cases we talk about before, and i'll send in their posts respectively
You do not have the required permissions to view the files attached to this post.
fateh78
 
Posts: 85
Joined: 16 Mar 2017 21:45

by Jorge Sousa » 22 Dec 2017 12:28

Hi Fateh

Sorry, but there was a lot of information i had to give you in order for you to make your own custom components for Intraweb / CGDevTools.

We don't have the time or the resources to do this.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fateh78 » 22 Dec 2017 14:40

so please help in just 2 questions :
1- how to assign javascript to the button onclick event
2- how to identify itemindex for the clicked button (how to add itemindex to event params)

i think it would be a good idea if added 2 buttons (remove, edit) to the component

i'll appreciate your help highly
fateh78
 
Posts: 85
Joined: 16 Mar 2017 21:45

by Jorge Sousa » 22 Dec 2017 15:37

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);
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Jorge Sousa » 22 Dec 2017 15:37

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
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by fateh78 » 24 Dec 2017 00:51

i make it working, but i am not sure if this is the correct way :?:
it would be nice if you review this updated demo

also 2 notes :
1- i needed to call : Self.AjaxReRender(False, False);
to update the list, is there a function to update the list without rerender ?! :idea:
2- the list items expand out of containing panel
is there a way to show scrollbars when list expand ?! :idea:

best regards dear Sousa :ugeek:
You do not have the required permissions to view the files attached to this post.
fateh78
 
Posts: 85
Joined: 16 Mar 2017 21:45

Next

Return to JQSortableList

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.