cristianotestai Posted July 10, 2014 Share 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 Link to comment Share on other sites More sharing options...
Oliver Morsch Posted July 11, 2014 Share Posted July 11, 2014 Use a text like this: <span onclick="alert(123)">Edit</span> Instead of "alert(123)" you must use "ajaxRequest(...)" Quote Link to comment Share on other sites More sharing options...
cristianotestai Posted July 12, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
cristianotestai Posted July 12, 2014 Author Share 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 Link to comment Share on other sites More sharing options...
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.