Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Modification to the way ID is found and created InlineEditorGroup #5

Merged
merged 1 commit into from Mar 21, 2012

Conversation

Projects
None yet
2 participants
Contributor

PeteAUK commented Nov 9, 2011

Modified so that if ID is passed within a data object then this will be used as the data id if one does not exist. e.g.

new InlineEditor(someObject, {
'url': 'myurl.php',
'data': {
'id': 10
}
});

The value of the field is given a default value if it exists.

After saving, any JSON result is passed back to the onSuccess method/function.

Added a getValue method. This retrieves the value of the field and returns it an object, based on the id passed.

Extend the Object method to have a "make" function. This allows you to pass a key & value and it returns an object with this. Normally it is not possible to set the key of an object programmatically.


InlineEditorGroup.

This object can be used to collect a number of InlineEditors together and retrieve the values for all of the items. This works very well if you set the url to null and can create a “form” of InlineEditors

It consists of five methods:
InlineEditorGroup.InlineEditor(el, options) – add a new InlineEditor to the grouping.
InlineEditorGroup.Combo(el, options) – add a new InlineEditor.Combo to the grouping.
InlineEditorGroup.Textarea(el, options) – add a new InlineEditor.Textarea to the grouping.
InlineEditorGroup.toObject() – retrieve an object of id: value pairs for all editors within the grouping.
InlineEditorGroup.toQueryString() – retrieve the id, value pairs for all editors within the grouping as a query string.

e.g.

InlineEditorGroup.InlineEditor($('text1'), {url: null, hide_buttons: true, data_id: 'text1'});
InlineEditorGroup.InlineEditor($('text2'), {url: null, hide_buttons: true, data_id: 'text2'});
InlineEditorGroup.Combo($('dropdown'), {url: null, hide_buttons: true, data_id: 'dropdown'});

InlineEditorGroup.toObject();

Would result in:
{
text1: "some value",
text2: "some value",
dropdown: "some value"
}

Modified so that if ID is passed within a data object then this will …
…be used as the data id if one does not exist. e.g.

new InlineEditor(someObject, {
	'url': 'myurl.php',
	'data': {
		'id': 10
	}
});


The value of the <input> field is given a default value if it exists.


After saving, any JSON result is passed back to the onSuccess method/function.


Added a getValue method.  This retrieves the value of the field and returns it an object, based on the id passed.


Extend the Object method to have a "make" function.  This allows you to pass a key & value and it returns an object with this.  Normally it is not possible to set the key of an object programmatically.

---

InlineEditorGroup.

This object can be used to collect a number of InlineEditors together and retrieve the values for all of the items.  This works very well if you set the url to null and can create a “form” of InlineEditors

It consists of five methods:
InlineEditorGroup.InlineEditor(el, options) – add a new InlineEditor to the grouping.
InlineEditorGroup.Combo(el, options) – add a new InlineEditor.Combo to the grouping.
InlineEditorGroup.Textarea(el, options) – add a new InlineEditor.Textarea to the grouping.
InlineEditorGroup.toObject() – retrieve an object of id: value pairs for all editors within the grouping.
InlineEditorGroup.toQueryString() – retrieve the id, value pairs for all editors within the grouping as a query string.

e.g.

InlineEditorGroup.InlineEditor($('text1'), {url: null, hide_buttons: true, data_id: 'text1'});
InlineEditorGroup.InlineEditor($('text2'), {url: null, hide_buttons: true, data_id: 'text2'});
InlineEditorGroup.Combo($('dropdown'), {url: null, hide_buttons: true, data_id: 'dropdown'});

InlineEditorGroup.toObject();

Would result in:
{
text1: "some value",
text2: "some value",
dropdown: "some value"
}

reednj added a commit that referenced this pull request Mar 21, 2012

Merge pull request #5 from PeteAUK/master
Modification to the way ID is found and created InlineEditorGroup

@reednj reednj merged commit fcaefd1 into reednj:master Mar 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment