Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#ddlGrouped").editable("url", {
- type: 'select',
- submit: 'OK',
- data: {
- 'Swedish Cars' : { 'volvo': 'Volvo', 'saab': 'Saab'},
- 'German Cars' : { 'mercedes': 'Mercedes', 'audi': 'Audi'}
- }
- })
- select: {
- element: function (settings, original) {
- var select = $('<select />');
- $(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 () {
- if ($(this).val() == json['selected'] ||
- $(this).text() == $.trim(original.revert)) {
- $(this).attr('selected', 'selected');
- }
- });
- }
- }
- selectactioner: {
- element : function(settings, original) {
- var select = $('<select />');
- $(this).append(select);
- return(select);
- },
- content : function(data, settings, original) {
- var obj = jQuery.parseJSON(data);
- var json = obj.attendees;
- var json2 = obj.nonattendees;
- var optgroup = $('<optgroup />');
- optgroup.attr('label', 'Meeting Attendees');
- $('select', this).append(optgroup);
- 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() {
- if ($(this).val() == json['selected'] ||
- $(this).text() == $.trim(original.revert)) {
- $(this).attr('selected', 'selected');
- }
- });
- var optgroup = $('<optgroup />');
- optgroup.attr('label', 'Other Users');
- $('select', this).append(optgroup);
- for (var key in json2) {
- if (!json2.hasOwnProperty(key)) {
- continue;
- }
- if ('selected' == key) {
- continue;
- }
- var option = $('<option />').val(key).append(json2[key]);
- $('select', this).append(option);
- }
- /* Loop option again to set selected. IE needed this... */
- $('select', this).children().each(function() {
- if ($(this).val() == json2['selected'] ||
- $(this).text() == $.trim(original.revert)) {
- $(this).attr('selected', 'selected');
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement