资源说明:A javascript edit-in-place control using mootools
InlineEditor ============ InlineEditor allows any text element to be made editable. The user clicks on it, and it turns into a textbox with a save and cancel button. On save a request is sent to the server with the new value, and any other needed metadata. ![ScreenShot](http://i.imgur.com/h6j3X.png) How to use ---------- Include the InlineEditor.js and InlineEditor.css (and InlineEditor.Combo.js if you need drop down lists) in the header: Make elements editable like this: new InlineEditor(element, {url: 'save-change.php'}); When the editbox is saved a GET request will be made to that url with the new data. Maybe you need to send some meta-data such as a row_id along with the request. Use the 'id' option: new InlineEditor(element, {url: 'save-change.php', 'data':{'id':15}}); You can also place these attributes on the element its self, like this:data valuedata value// then you could initialize all these at once like this: $$('.editable').each(function(item) { new InlineEditor(item); } Drop Down Lists --------------- Use InlineEditor.Combo.js to let the user set input from a drop down list, instead of with a textbox These are created in the same way as regular InlineEditors but have more settings to deal with setting the list of options in the dropdown. This can be done in the javascript constructor: new InlineEditor.Combo(element, { url: 'save-edit.php', options_list: [ {'text':'one', 'value':'1'}, {'text':'two', 'value':'2'}, {'text':'three', 'value':'3', 'selected':true} ] }); or in the dom:Textarea -------- For editing large amounts of text inline, use InlineEditor.Textarea. This works exactly the same as the regular inline editor, except that it creates a Textarea when clicked on, instead of a standard input box. Server Request Format --------------------- This class will make a request to the given url as a GET, POST or JSON request. The new value will be sent as 'value', and the extra data will be sent as it is given in the 'data' option. If there is an error you should return a '500' code. If you send back error information with the type 'application/json' in the format {code:, message:} the message will be shown as the error on the screen, otherwise a generic error message is shown.OneTwoThree
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。