Changes between Version 1 and Version 2 of Ticket #10623, comment 2


Ignore:
Timestamp:
Sep 25, 2014, 8:35:24 PM (8 years ago)
Author:
sparkybg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10623, comment 2

    v1 v2  
    1515    $("#locationInput").myInput({field:"location", dataStore:commonDataStore});
    1616}}}
    17 3. The widgets purpose is to save their value to the common data store object for further processing, either by a web application itself, or to send the entire object to the server via AJAX request or whatever. The widgets themselves are doing this for example every time they loose focus. In order to do so, the widgets must know what common object they are using, and I think the most obvious way to do this is to provide this common data store object when they are created. But, with current implementation of widget factory, when "_create" method is invoked, all pure objects in "this.options" are already deep copied, and extended with default options if available. So, the widgets receive a copy or the "commonDataStore" object instead of the object itself. And, I cannot find any "legal" way to get access to the original data store object other than providing it explicitly with
     173. The widgets purpose is to save their value to the common data store object for further processing, either by a web application itself, or to send the entire object to the server via AJAX request or whatever. The widgets themselves are doing this for example every time they loose focus. In order to do so, the widgets must know what common object they are using, and I think the most obvious way to do this is to provide this common data store object when they are created. But, with current implementation of widget factory, when "_create" method is invoked, all pure objects in "this.options" are already deep copied, and extended with default options if available. So, the widgets receive a copy or the "commonDataStore" object instead of the object itself. And, I cannot find any "legal" way to get access to the original data store object other than providing it explicitly after the widgets are created:
    1818{{{
    1919   $("#nameInput").myInput("option","dataStore",commonDataStore);
     20   ....
    2021}}}
    21 after the widgets are created.
    2222
    2323So, I think it will be a nice feature if at least the widget's "_create" method has access to the options as provided on creation, not only the copied and extended version of them. For the moment, only the internal "_createWidget" method has access to them. In fact this method itself is making the copy of the options and extends them with defaults.