Closed tdzieciol closed 8 years ago
Fixed in latest commit. Take care to replace wwwroot/iwbs/iwbs.js with latest one. Please test it.
TIWBSText component is updated properly. But I have another problem. I add own script in WebApplication.CallbackResponse.AddJavaScriptToExecute to do something with updated component (i.e. reinitialize updated data table). Unfortunately, my script is executed before updating the content of the component and is working on its outdated content. Is there any way to solve this problem?
There are several ways to correctly approach it, (but you need to download latest commit):
a) Put script in the Script property of the component. This script will be rendered inside the tag after the html so any change in object or script will be automatically reflected when anything change. You also have a ScriptParams property that replace values in string. (See bootstrap tables on Demo) .
b) Execute "WebApplication.CallbackResponse.AddJavaScriptToExecute" on OnAsyncRender event of the control. This event happens after component is updated.
c) If you have several controls in you page, for example select inputs, and you want to apply same javascript to all of them (refresh some third party plugin) yo can use global hook "gIWBSOnRenderAsync". See BOOTSTRAPSELECT in ServerController.pas on Demo.
Regards
Thanks for your suggestions. You can close this issue. Regards
Please, if you can, I'll appreciate if you first test the tree ways I suggest to you and let me know if they all works correctly. I prefer to close this issue after that.
I checked all three ways and work for me properly. For global hook I prefer solutions based on a list of procedures that I can register individually instead of a single procedure. This makes it easier to build the program in a modular way.
For global hook I prefer solutions based on a list of procedures that I can register individually
Could you explain me that a little more? May be an example?
Plase drop on form TIWBSText component, set RawText:=True and fill Lines with simple unorder list html code. Next drop on form TIWBSButton and in OnAsyncClick event modify TIWBSText.Lines property (i.e. add option). After button click page is not updated. I think it's work properly in version before Oct 8, 2015