You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just finished an article on this plugin and wanted to pass along some things I thought could make it easier to work with. Right now I think the plugin is somewhat tough to use in that it exposes only 2 functions and doesn't offer a lot of helper functions (Ignoring the fact that the documentation isn't up to date).
First feature request - a function called updateLinkedJSON(json, dataObj)
Basically, a utility function in the plugin that does this
$.each(json, function(key, value){
$(dataObj).data(key, value );
});
The purpose of the plugin is to support one and two-way linking between form input elements and objects (and possibly elem-elem and object-object). It does not seem this suggestion speaks to the goals of linking objects to elements, but just a convenient way to copy data from another location into the linked object. There are many many ways an ajax request may result in an update to a source object, and it would seem this would best be left up to the developer, especially in cases where jQuery already provides such an elegant (almost one line) means of accomplishing the goal from your example.
At present, the goal of linking form elements to data is itself unfulfilled, as the current plugin only supports text and single-select controls, not checkboxes, checkbox lists, radio buttons, or multi-select lists, so priority should first be placed on implementing this and providing real-world examples and articles on how to establish links and leverage the power of converters to do many interesting things.
I just finished an article on this plugin and wanted to pass along some things I thought could make it easier to work with. Right now I think the plugin is somewhat tough to use in that it exposes only 2 functions and doesn't offer a lot of helper functions (Ignoring the fact that the documentation isn't up to date).
First feature request - a function called updateLinkedJSON(json, dataObj)
Basically, a utility function in the plugin that does this
$.each(json, function(key, value){
$(dataObj).data(key, value );
});
and be called in an example like this:
$.get("ajax.jsp", {}, function(data){
updateLinkedJSON(data, dataObj);
}, "json");
The text was updated successfully, but these errors were encountered: