Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multiSelect: {
- element : function(settings, original) {
- var select = $('<select multiple size=10/>');
- $(this).append(select);
- return(select);
- },
- content : function(data, settings, original) {
- /* If it is string assume it is json. */
- if (String == data.constructor) {
- eval ('var json = ' + data);
- } else {
- /* Otherwise assume it is a hash already. */
- var json = data;
- }
- for (var key in json) {
- if (!json.hasOwnProperty(key)) {
- continue;
- }
- if ('selected' == key) {
- continue;
- }
- var option = $('<option />').val(key).append(json[key]);
- $('select', this).append(option);
- }
- /* Loop option again to set selected. IE needed this... */
- $('select', this).children().each(function() {
- var option = $(this);
- $.each(json.selected, function(index, value) {
- if ( option.val() == value ||
- option.text() == $.trim(original.revert)) {
- option.attr('selected', 'selected');
- }
- })
- });
- }//,
- // submitdata : function(value, settings) {
- // console.log('insubmitdata');
- // return $('select',this).val();
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement