Permalink
Browse files

Editable: Temporary Spinner editor implementation.

  • Loading branch information...
1 parent 68f2138 commit 1cd5ea7285993179af888f94dd15c3e55406a873 @rxaviers committed Dec 7, 2011
Showing with 21 additions and 2 deletions.
  1. +10 −1 demos/editable/editors.html
  2. +11 −1 ui/jquery.ui.editable.js
@@ -8,6 +8,7 @@
<script src="../../ui/jquery.ui.core.js"></script>
<script src="../../ui/jquery.ui.widget.js"></script>
<script src="../../ui/jquery.ui.button.js"></script>
+ <script src="../../ui/jquery.ui.spinner.js"></script>
<script src="../../ui/jquery.ui.datepicker.js"></script>
<script src="../../ui/jquery.ui.editable.js"></script>
<link rel="stylesheet" href="../demos.css">
@@ -30,8 +31,12 @@
}
}
});
+ $( "#spinner" ).editable({
+ editor: "spinner",
+ placeholder: "Spinner"
+ });
$( "#datepicker" ).editable({
- // Set an editor while passing custom options to it
+ // Setting a different editor with custom options
editor: {
datepicker: {
changeMonth: true,
@@ -76,6 +81,10 @@
</p>
<p>
+<span class="sample" id="spinner"></span>
+</p>
+
+<p>
<span class="sample" id="datepicker"></span>
</p>
View
@@ -318,7 +318,6 @@ $.ui.editable.editors = {
}
},
select: $.noop,
- spinner: $.noop,
datepicker: {
element: function( editable ) {
return $.ui.editable.editors.text.element( editable );
@@ -333,6 +332,17 @@ $.ui.editable.editors = {
}
};
+$.extend($.ui.editable.editors, {
+ spinner: {
+ element: $.ui.editable.editors.text.element,
+ bind: function( editable ) {
+ $.ui.editable.editors.text.bind( editable );
+ $( "input", editable.element ).spinner( editable.options.editorOptions ).focus();
+ },
+ value: $.ui.editable.editors.text.value
+ }
+});
+
$.ui.editable.defaults = {
saveButton: {
label: "Save",

0 comments on commit 1cd5ea7

Please sign in to comment.