Jump to content

Text in UniDBGrid with "Click" AjaxRequest


Recommended Posts


In a UniDBGrid, I have a field that content is a plain text (String).
How can I set up an event "click" for performing a ajaxRequest this text?

The attached image shows an example where the text "Edit" I need to perform a ajaxRequest to open another form.

Anyone have any ideas?



Link to comment
Share on other sites

Use a text like this:


<span onclick="alert(123)">Edit</span>

Instead of "alert(123)" you must use "ajaxRequest(...)"


Hi Oliver, 
I tried using ajaxRequest, but without success. 
My code is in the OnGetText TField event, located in MainModule, as follows: 
procedure TMainModule.cdsAccounteditGetText(Sender: TField;
  var Text: string; DisplayText: Boolean);
  Text := '<span style="text-decoration: underline; color: #004891; cursor: pointer" ' +
   ' onclick="ajaxRequest(sender, '+QuotedStr('search')+');">Edit</span>';


How do I capture the ajaxRequest? In theory, not have OnAjaxEvent for this text. 
Thanks for your help.
Link to comment
Share on other sites

 Hi Oliver!


 Seconds after I post, I remember that I needed to reference the form and component related the "sender", and it worked correctly, Thanks!


Bellow the code:


 Text := '<span style="text-decoration: underline; color: #004891; cursor: pointer" ' +
   ' onclick="ajaxRequest(fmAccount.btSearch, '+QuotedStr('search')+');">Edit</span>';
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...