cristianotestai Posted July 10, 2014 Posted July 10, 2014 Hello,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? Quote
Oliver Morsch Posted July 11, 2014 Posted July 11, 2014 Use a text like this: <span onclick="alert(123)">Edit</span> Instead of "alert(123)" you must use "ajaxRequest(...)" Quote
cristianotestai Posted July 12, 2014 Author Posted July 12, 2014 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); begin Text := '<span style="text-decoration: underline; color: #004891; cursor: pointer" ' + ' onclick="ajaxRequest(sender, '+QuotedStr('search')+');">Edit</span>'; end; How do I capture the ajaxRequest? In theory, not have OnAjaxEvent for this text. Thanks for your help. Quote
cristianotestai Posted July 12, 2014 Author Posted July 12, 2014 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>'; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.