#9977 closed Bug (invalid)
Bug: getData(true) returns 'old' data.
Reported by: | Juan Pablo | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 4.0.2 |
Keywords: | Cc: |
Description
Calling getData(true) (so it doesn't fire any events) returns 'old' data (the editor data is not updated to what has been entered).
I've checked the code and seen that passing the parameter prevents the 'beforeGetData' event to be fired, which appears to the reason why the data returned is not updated. As 'beforeGetData' is an "Internal Event" (http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-beforeGetData) it should be fired event if the getData method is called with true as a parameter.
Change History (3)
comment:1 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 12 years ago by
I'm using the getData event with a plugin that auto detect links and replaces them with <a> tags. That operation is pretty expensive.
Then, I'm using the getData method to check if the editor content is valid to enable a submit button every time a key is pressed. I don't want those calls to trigger the getData event but I want the data to be updated. That's the case when I'm using getData( true ). I think it doesn't make sense to have the possibility to call the method with no events if the data that will be returned is useless.
As a workaround, I'm currently manually firing the 'beforeGetData' event before the getData( true ) but I think that's ugly because 'beforeGetData' is documented as an internal event.
comment:3 Changed 12 years ago by
You're right that getData is expensive. Thus, it's better to use lighter getSnapshot for this purpose.
getData( true ) is used only internally when some component knows that data were recently updated (e.g. during start up).
getData works exactly as indented. You pass noEvents == true, so beforeGetData isn't fired and as it is documented this is an event "to get the current data". So you have old data if you prevented it.
BTW. Why do you use
getData( true )
?