diff --git a/lib/jquery.jtable.js b/lib/jquery.jtable.js index 869af246..8a9bf2b1 100644 --- a/lib/jquery.jtable.js +++ b/lib/jquery.jtable.js @@ -1,4 +1,4 @@ -/* +/* jTable 2.4.0 http://www.jtable.org @@ -804,6 +804,7 @@ THE SOFTWARE. funcParams = $.extend(true, { _cacheCleared: false, dependedValues: {}, + tableoptions: this.options, clearCache: function () { this._cacheCleared = true; } @@ -1556,6 +1557,8 @@ THE SOFTWARE. return this._createPasswordInputForField(field, fieldName, value); } else if (field.type == 'checkbox') { return this._createCheckboxForField(field, fieldName, value); + } else if (field.type == 'multiselectddl') { + return this._createDropDownListMultiForField(field, fieldName, value); } else if (field.options) { if (field.type == 'radiobutton') { return this._createRadioButtonListForField(field, fieldName, value, record, formType); @@ -1691,6 +1694,38 @@ THE SOFTWARE. return $containerDiv; }, + _createDropDownListMultiForField: function (field, fieldName, value) { + //Create a container div + var $containerDiv = $('
'); + + //Create multi-select element + var $select = $('').appendTo($containerDiv); + + var options = this._getOptionsForField(fieldName); + if (value) { + if (typeof value === 'string') { + var values = value.split(','); + } else { //(Object.prototype.toString.call(value) === '[object Array]') { + values = value; + } + + //add options + $.each(options, function(index, element) { + //$select.append(''); + $select.append(''); + }); + $.each(values, function(index, element) { + $select.children('option[value="' + element + '"]').attr("selected", "selected"); + }); + } else { + $.each(options, function (index, element) { + $select.append(''); + }); + } + + return $containerDiv; + }, + /* Creates a drop down list (combobox) input element for a field. *************************************************************************/ _createDropDownListForField: function (field, fieldName, value, record, source, form) { @@ -2631,6 +2666,8 @@ THE SOFTWARE. self._$editingRow = $tableRow; self._$editDiv.append($editForm).dialog('open'); self._trigger("formCreated", null, { form: $editForm, formType: 'edit', record: record, row: $tableRow }); + + //$('input').first().focus().blur(); }, /* Saves editing form to the server and updates the record on the table.