Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion lib/jquery.jtable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*

jTable 2.4.0
http://www.jtable.org
Expand Down Expand Up @@ -804,6 +804,7 @@ THE SOFTWARE.
funcParams = $.extend(true, {
_cacheCleared: false,
dependedValues: {},
tableoptions: this.options,
clearCache: function () {
this._cacheCleared = true;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -1691,6 +1694,38 @@ THE SOFTWARE.
return $containerDiv;
},

_createDropDownListMultiForField: function (field, fieldName, value) {
//Create a container div
var $containerDiv = $('<div class="jtable-input jtable-multi-dropdown-input"></div>');

//Create multi-select element
var $select = $('<select multiple="multiple" class="' + field.inputClass + '" id="Edit-' + fieldName + '" name=' + fieldName + '></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('<option value="' + element.Value + '"' + (element.Value == elementOut ? ' selected="selected"' : '') + '>' + element.DisplayText + '</option>');
$select.append('<option value="' + element.Value + '"' + '>' + element.DisplayText + '</option>');
});
$.each(values, function(index, element) {
$select.children('option[value="' + element + '"]').attr("selected", "selected");
});
} else {
$.each(options, function (index, element) {
$select.append('<option value="' + element.Value + '">' + element.DisplayText + '</option>');
});
}

return $containerDiv;
},

/* Creates a drop down list (combobox) input element for a field.
*************************************************************************/
_createDropDownListForField: function (field, fieldName, value, record, source, form) {
Expand Down Expand Up @@ -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.
Expand Down