FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
jquery.dataTables.editable.js
1 /*
2 * File: jquery.dataTables.editable.js
3 * Version: 2.3.3.
4 * Author: Jovan Popovic
5 *
6 * Copyright 2010-2012 Jovan Popovic, all rights reserved.
7 *
8 * This source file is free software, under either the GPL v2 license or a
9 * BSD style license, as supplied with this software.
10 *
11 * This source file is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * Parameters:
16 * @sUpdateURL String URL of the server-side page used for updating cell. Default value is "UpdateData".
17 * @sAddURL String URL of the server-side page used for adding new row. Default value is "AddData".
18 * @sDeleteURL String URL of the server-side page used to delete row by id. Default value is "DeleteData".
19 * @fnShowError Function function(message, action){...} used to show error message. Action value can be "update", "add" or "delete".
20 * @sAddNewRowFormId String Id of the form for adding new row. Default id is "formAddNewRow".
21 * @oAddNewRowFormOptions Object Options that will be set to the "Add new row" dialog
22 * @sAddNewRowButtonId String Id of the button for adding new row. Default id is "btnAddNewRow".
23 * @oAddNewRowButtonOptions Object Options that will be set to the "Add new" button
24 * @sAddNewRowOkButtonId String Id of the OK button placed in add new row dialog. Default value is "btnAddNewRowOk".
25 * @oAddNewRowOkButtonOptions Object Options that will be set to the Ok button in the "Add new row" form
26 * @sAddNewRowCancelButtonId String Id of the Cancel button placed in add new row dialog. Default value is "btnAddNewRowCancel".
27 * @oAddNewRowCancelButtonOptions Object Options that will be set to the Cancel button in the "Add new row" form
28 * @sDeleteRowButtonId String Id of the button for adding new row. Default id is "btnDeleteRow".
29 * @oDeleteRowButtonOptions Object Options that will be set to the Delete button
30 * @sSelectedRowClass String Class that will be associated to the selected row. Default class is "row_selected".
31 * @sReadOnlyCellClass String Class of the cells that should not be editable. Default value is "read_only".
32 * @sAddDeleteToolbarSelector String Selector used to identify place where add and delete buttons should be placed. Default value is ".add_delete_toolbar".
33 * @fnStartProcessingMode Function function(){...} called when AJAX call is started. Use this function to add "Please wait..." message when some button is pressed.
34 * @fnEndProcessingMode Function function(){...} called when AJAX call is ended. Use this function to close "Please wait..." message.
35 * @aoColumns Array Array of the JEditable settings that will be applied on the columns
36 * @sAddHttpMethod String Method used for the Add AJAX request (default is 'POST')
37 * @sAddDataType String Data type expected from the server when adding a row; allowed values are the same as those accepted by JQuery's "datatype" parameter, e.g. 'text' and 'json'. The default is 'text'.
38 * @sDeleteHttpMethod String Method used for the Delete AJAX request (default is 'POST')
39 * @sDeleteDataType String Data type expected from the server when deleting a row; allowed values are the same as those accepted by JQuery's "datatype" parameter, e.g. 'text' and 'json'. The default is 'text'.
40 * @fnOnDeleting Function function(tr, id, fnDeleteRow){...} Function called before row is deleted.
41 tr isJQuery object encapsulating row that will be deleted
42 id is an id of the record that will be deleted.
43 fnDeleteRow(id) callback function that should be called to delete row with id
44 returns true if plugin should continue with deleting row, false will abort delete.
45 * @fnOnDeleted Function function(status){...} Function called after delete action. Status can be "success" or "failure"
46 * @fnOnAdding Function function(){...} Function called before row is added.
47 returns true if plugin should continue with adding row, false will abort add.
48 * @fnOnNewRowPosted Function function(data) Function that can override default function that is called when server-side sAddURL returns result
49 You can use this function to add different behaviour when server-side page returns result
50 * @fnOnAdded Function function(status){...} Function called after add action. Status can be "success" or "failure"
51 * @fnOnEditing Function function(input){...} Function called before cell is updated.
52 input JQuery object wrapping the input element used for editing value in the cell.
53 returns true if plugin should continue with sending AJAX request, false will abort update.
54 * @fnOnEdited Function function(status){...} Function called after edit action. Status can be "success" or "failure"
55 * @sEditorHeight String Default height of the cell editors
56 * @sEditorWidth String Default width of the cell editors
57 * @oDeleteParameters Object Additonal objects added to the DELETE Ajax request
58 * @oUpdateParameters Object Additonal objects added to the UPDATE Ajax request
59 * @sIDToken String Token in the add new row dialog that will be replaced with a returned id of the record that is created eg DT_RowId
60 * @sSuccessResponse String Text returned from the server if record is successfully deleted or edited. Default "ok"
61 * @sFailureResponsePrefix String Prefix of the error message returned form the server during edit action
62 */
63 (function ($) {
64 
65  $.fn.makeEditable = function (options) {
66 
67  var iDisplayStart = 0;
68 
69  function fnGetCellID(cell) {
78 
79  return properties.fnGetRowID($(cell.parentNode));
80  }
81 
82  function _fnSetRowIDInAttribute(row, id, overwrite) {
93 
94  if (overwrite) {
95  row.attr("id", id);
96  } else {
97  if (row.attr("id") == null || row.attr("id") == "") {
98  row.attr("id", id);
99  }
100  }
101  }
102 
103  function _fnGetRowIDFromAttribute(row) {
114 
115  return row.attr("id");
116  }
117 
118  function _fnSetRowIDInFirstCell(row, id) {
129 
130  $("td:first", row).html(id);
131  }
132 
133 
134  function _fnGetRowIDFromFirstCell(row) {
145 
146  return $("td:first", row).html();
147 
148  }
149 
150  //Reference to the DataTable object
151  var oTable;
152  //Refences to the buttons used for manipulating table data
153  var oAddNewRowButton, oDeleteRowButton, oConfirmRowAddingButton, oCancelRowAddingButton;
154  //Reference to the form used for adding new data
155  var oAddNewRowForm;
156 
157  //Plugin options
158  var properties;
159 
160  function _fnShowError(errorText, action) {
166 
167  alert(errorText);
168  }
169 
170  function _fnStartProcessingMode() {
174 
175  if (oTable.fnSettings().oFeatures.bProcessing) {
176  $(".dataTables_processing").css('visibility', 'visible');
177  }
178  }
179 
180  function _fnEndProcessingMode() {
185 
186  if (oTable.fnSettings().oFeatures.bProcessing) {
187  $(".dataTables_processing").css('visibility', 'hidden');
188  }
189  }
190 
191  var sOldValue, sNewCellValue, sNewCellDislayValue;
192 
193  function fnApplyEditable(aoNodes) {
198 
199  if (properties.bDisableEditing) {
200  return;
201  }
202  var oDefaultEditableSettings = {
203  event: 'click',
204 
205  "onsubmit": function (settings, original) {
206  sOldValue = original.revert;
207  sNewCellValue = null;
208  sNewCellDisplayValue = null;
209  iDisplayStart = fnGetDisplayStart();
210 
211  if(settings.type == "text" || settings.type == "select" || settings.type == "textarea" )
212  {
213  var input = $("input,select,textarea", this);
214  sNewCellValue = $("input,select,textarea", $(this)).val();
215  if (input.length == 1) {
216  var oEditElement = input[0];
217  if (oEditElement.nodeName.toLowerCase() == "select" || oEditElement.tagName.toLowerCase() == "select") {
218  sNewCellDisplayValue = $("option:selected", oEditElement).text(); //For select list use selected text instead of value for displaying in table
219  } else {
220  sNewCellDisplayValue = sNewCellValue;
221  }
222  }
223 
224  if (!properties.fnOnEditing(input, settings, original.revert, fnGetCellID(original))) {
225  return false;
226  }
227  var x = settings;
228 
229  //2.2.2 INLINE VALIDATION
230  if (settings.oValidationOptions != null) {
231  input.parents("form").validate(settings.oValidationOptions);
232  }
233  if (settings.cssclass != null) {
234  input.addClass(settings.cssclass);
235  }
236  if(settings.cssclass == null && settings.oValidationOptions == null){
237  return true;
238  }else{
239  if (!input.valid() || 0 == input.valid()) {
240  return false;
241  } else {
242  return true;
243  }
244  }
245 
246  }
247 
248  properties.fnStartProcessingMode();
249  },
250  "submitdata": function (value, settings) {
251  //iDisplayStart = fnGetDisplayStart();
252  //properties.fnStartProcessingMode();
253  var id = fnGetCellID(this);
254  var rowId = oTable.fnGetPosition(this)[0];
255  var columnPosition = oTable.fnGetPosition(this)[1];
256  var columnId = oTable.fnGetPosition(this)[2];
257  var sColumnName = oTable.fnSettings().aoColumns[columnId].sName;
258  if (sColumnName == null || sColumnName == "") {
259  sColumnName = oTable.fnSettings().aoColumns[columnId].sTitle;
260  }
261  var updateData = null;
262  if (properties.aoColumns == null || properties.aoColumns[columnId] == null) {
263  updateData = $.extend({},
264  properties.oUpdateParameters,
265  {
266  "id": id,
267  "rowId": rowId,
268  "columnPosition": columnPosition,
269  "columnId": columnId,
270  "columnName": sColumnName
271  });
272  }
273  else {
274  updateData = $.extend({},
275  properties.oUpdateParameters,
276  properties.aoColumns[columnId].oUpdateParameters,
277  {
278  "id": id,
279  "rowId": rowId,
280  "columnPosition": columnPosition,
281  "columnId": columnId,
282  "columnName": sColumnName
283  });
284  }
285  return updateData;
286  },
287  "callback": function (sValue, settings) {
288  properties.fnEndProcessingMode();
289  var status = "";
290  var aPos = oTable.fnGetPosition(this);
291 
292  var bRefreshTable = !oSettings.oFeatures.bServerSide;
293  $("td.last-updated-cell", oTable.fnGetNodes( )).removeClass("last-updated-cell");
294  if(sValue.indexOf(properties.sFailureResponsePrefix)>-1)
295  {
296  oTable.fnUpdate(sOldValue, aPos[0], aPos[2], bRefreshTable);
297  $("td.last-updated-cell", oTable).removeClass("last-updated-cell");
298  $(this).addClass("last-updated-cell");
299  properties.fnShowError(sValue.replace(properties.sFailureResponsePrefix, "").trim(), "update");
300  status = "failure";
301  } else {
302 
303  if (properties.sSuccessResponse == "IGNORE" ||
304  ( properties.aoColumns != null
305  && properties.aoColumns[aPos[2]] != null
306  && properties.aoColumns[aPos[2]].sSuccessResponse == "IGNORE") ||
307  (sNewCellValue == null) || (sNewCellValue == sValue) ||
308  properties.sSuccessResponse == sValue) {
309  if(sNewCellDisplayValue == null)
310  {
311  //sNewCellDisplayValue = sValue;
312  oTable.fnUpdate(sValue, aPos[0], aPos[2], bRefreshTable);
313  }else{
314  oTable.fnUpdate(sNewCellDisplayValue, aPos[0], aPos[2], bRefreshTable);
315  }
316  $("td.last-updated-cell", oTable).removeClass("last-updated-cell");
317  $(this).addClass("last-updated-cell");
318  status = "success";
319  } else {
320  oTable.fnUpdate(sOldValue, aPos[0], aPos[2], bRefreshTable);
321  properties.fnShowError(sValue, "update");
322  status = "failure";
323  }
324  }
325 
326  properties.fnOnEdited(status, sOldValue, sNewCellDisplayValue, aPos[0], aPos[1], aPos[2]);
327  if (settings.fnOnCellUpdated != null) {
328  settings.fnOnCellUpdated(status, sValue, aPos[0], aPos[2], settings);
329  }
330 
331  fnSetDisplayStart();
332  if (properties.bUseKeyTable) {
333  var keys = oTable.keys;
334  /* Unblock KeyTable, but only after this 'esc' key event has finished. Otherwise
335  * it will 'esc' KeyTable as well
336  */
337  setTimeout(function () { keys.block = false; }, 0);
338  }
339  },
340  "onerror": function () {
341  properties.fnEndProcessingMode();
342  properties.fnShowError("Cell cannot be updated", "update");
343  properties.fnOnEdited("failure");
344  },
345 
346  "onreset": function(){
347  if (properties.bUseKeyTable) {
348  var keys = oTable.keys;
349  /* Unblock KeyTable, but only after this 'esc' key event has finished. Otherwise
350  * it will 'esc' KeyTable as well
351  */
352  setTimeout(function () { keys.block = false; }, 0);
353  }
354 
355  },
356  "height": properties.sEditorHeight,
357  "width": properties.sEditorWidth
358  };
359 
360  var cells = null;
361 
362  if (properties.aoColumns != null) {
363 
364  for (var iDTindex = 0, iDTEindex = 0; iDTindex < oSettings.aoColumns.length; iDTindex++) {
365  if (oSettings.aoColumns[iDTindex].bVisible) {//if DataTables column is visible
366  if (properties.aoColumns[iDTEindex] == null) {
367  //If editor for the column is not defined go to the next column
368  iDTEindex++;
369  continue;
370  }
371  //Get all cells in the iDTEindex column (nth child is 1-indexed array)
372  cells = $("td:nth-child(" + (iDTEindex + 1) + ")", aoNodes);
373 
374  var oColumnSettings = oDefaultEditableSettings;
375  oColumnSettings = $.extend({}, oDefaultEditableSettings, properties.oEditableSettings, properties.aoColumns[iDTEindex]);
376  iDTEindex++;
377  var sUpdateURL = properties.sUpdateURL;
378  try {
379  if (oColumnSettings.sUpdateURL != null) {
380  sUpdateURL = oColumnSettings.sUpdateURL;
381  }
382  } catch (ex) {
383  }
384  //cells.editable(sUpdateURL, oColumnSettings);
385  cells.each(function () {
386  if (!$(this).hasClass(properties.sReadOnlyCellClass)) {
387  $(this).editable(sUpdateURL, oColumnSettings);
388  }
389  });
390  }
391 
392  } //end for
393  } else {
394  cells = $('td:not(.' + properties.sReadOnlyCellClass + ')', aoNodes);
395  cells.editable(properties.sUpdateURL, $.extend({}, oDefaultEditableSettings, properties.oEditableSettings));
396  }
397  }
398 
399  function fnOnRowAdding(event) {
404 
405  if (properties.fnOnAdding()) {
406  if (oAddNewRowForm.valid()) {
407  iDisplayStart = fnGetDisplayStart();
408  properties.fnStartProcessingMode();
409 
410  if (properties.bUseFormsPlugin) {
411  //Still in beta(development)
412  $(oAddNewRowForm).ajaxSubmit({
413  dataType: 'xml',
414  success: function (response, statusString, xhr) {
415  if (xhr.responseText.toLowerCase().indexOf("error") != -1) {
416  properties.fnEndProcessingMode();
417  properties.fnShowError(xhr.responseText.replace("Error",""), "add");
418  properties.fnOnAdded("failure");
419  } else {
420  fnOnRowAdded(xhr.responseText);
421  }
422 
423  },
424  error: function (response) {
425  properties.fnEndProcessingMode();
426  properties.fnShowError(response.responseText, "add");
427  properties.fnOnAdded("failure");
428  }
429  }
430  );
431 
432  } else {
433 
434  var params = oAddNewRowForm.serialize();
435  $.ajax({ 'url': properties.sAddURL,
436  'data': params,
437  'type': properties.sAddHttpMethod,
438  'dataType': properties.sAddDataType,
439  success: fnOnRowAdded,
440  error: function (response) {
441  properties.fnEndProcessingMode();
442  properties.fnShowError(response.responseText, "add");
443  properties.fnOnAdded("failure");
444  }
445  });
446  }
447  }
448  }
449  event.stopPropagation();
450  event.preventDefault();
451  }
452 
453  function _fnOnNewRowPosted(data) {
456 
457  return true;
458  }
459 
460 
461  function fnOnRowAdded(data) {
467 
468  properties.fnEndProcessingMode();
469 
470  if (properties.fnOnNewRowPosted(data)) {
471 
472  var oSettings = oTable.fnSettings();
473  if (!oSettings.oFeatures.bServerSide) {
474  jQuery.data(oAddNewRowForm, 'DT_RowId', data);
475  var values = fnTakeRowDataFromFormElements(oAddNewRowForm);
476 
477 
478  var rtn;
479  //Add values from the form into the table
480  if (oSettings.aoColumns != null && isNaN(parseInt(oSettings.aoColumns[0].mDataProp))) {
481  rtn = oTable.fnAddData(rowData);
482  }
483  else {
484  rtn = oTable.fnAddData(values);
485  }
486 
487  var oTRAdded = oTable.fnGetNodes(rtn);
488  //add id returned by server page as an TR id attribute
489  properties.fnSetRowID($(oTRAdded), data, true);
490  //Apply editable plugin on the cells of the table
491  fnApplyEditable(oTRAdded);
492 
493  $("tr.last-added-row", oTable).removeClass("last-added-row");
494  $(oTRAdded).addClass("last-added-row");
495  } /*else {
496  oTable.fnDraw(false);
497  }*/
498  //Close the dialog
499  oAddNewRowForm.dialog('close');
500  $(oAddNewRowForm)[0].reset();
501  $(".error", $(oAddNewRowForm)).html("");
502 
503  fnSetDisplayStart();
504  properties.fnOnAdded("success");
505  if (properties.bUseKeyTable) {
506  var keys = oTable.keys;
507  /* Unblock KeyTable, but only after this 'esc' key event has finished. Otherwise
508  * it will 'esc' KeyTable as well
509  */
510  setTimeout(function () { keys.block = false; }, 0);
511  }
512  }
513  }
514 
515  function fnOnCancelRowAdding(event) {
521 
522  //Clear the validation messages and reset form
523  $(oAddNewRowForm).validate().resetForm(); // Clears the validation errors
524  $(oAddNewRowForm)[0].reset();
525 
526  $(".error", $(oAddNewRowForm)).html("");
527  $(".error", $(oAddNewRowForm)).hide(); // Hides the error element
528 
529  //Close the dialog
530  oAddNewRowForm.dialog('close');
531  event.stopPropagation();
532  event.preventDefault();
533  }
534 
535 
536  function fnDisableDeleteButton() {
540 
541  if (properties.bUseKeyTable) {
542  return;
543  }
544  if (properties.oDeleteRowButtonOptions != null) {
545  //oDeleteRowButton.disable();
546  oDeleteRowButton.button("option", "disabled", true);
547  } else {
548  oDeleteRowButton.attr("disabled", "true");
549  }
550  }
551 
552  function fnEnableDeleteButton() {
556 
557  if (properties.oDeleteRowButtonOptions != null) {
558  //oDeleteRowButton.enable();
559  oDeleteRowButton.button("option", "disabled", false);
560  } else {
561  oDeleteRowButton.removeAttr("disabled");
562  }
563  }
564 
565  var nSelectedRow, nSelectedCell;
566  var oKeyTablePosition;
567 
568 
569  function _fnOnRowDeleteInline(e) {
570 
571  var sURL = $(this).attr("href");
572  if (sURL == null || sURL == "") {
573  sURL = properties.sDeleteURL;
574  }
575 
576  e.preventDefault();
577  e.stopPropagation();
578 
579  iDisplayStart = fnGetDisplayStart();
580 
581  nSelectedCell = ($(this).parents('td'))[0];
582  jSelectedRow = ($(this).parents('tr'));
583  nSelectedRow = jSelectedRow[0];
584 
585  jSelectedRow.addClass(properties.sSelectedRowClass);
586 
587  var id = fnGetCellID(nSelectedCell);
588  if (properties.fnOnDeleting(jSelectedRow, id, fnDeleteRow)) {
589  fnDeleteRow(id, sURL);
590  }
591  }
592 
593 
594  function _fnOnRowDelete(event) {
599 
600  event.preventDefault();
601  event.stopPropagation();
602 
603  iDisplayStart = fnGetDisplayStart();
604 
605  nSelectedRow = null;
606  nSelectedCell = null;
607 
608  if (!properties.bUseKeyTable) {
609  if ($('tr.' + properties.sSelectedRowClass + ' td', oTable).length == 0) {
610  //oDeleteRowButton.attr("disabled", "true");
611  _fnDisableDeleteButton();
612  return;
613  }
614  nSelectedCell = $('tr.' + properties.sSelectedRowClass + ' td', oTable)[0];
615  } else {
616  nSelectedCell = $('td.focus', oTable)[0];
617 
618  }
619  if (nSelectedCell == null) {
620  fnDisableDeleteButton();
621  return;
622  }
623  if (properties.bUseKeyTable) {
624  oKeyTablePosition = oTable.keys.fnGetCurrentPosition();
625  }
626  var id = fnGetCellID(nSelectedCell);
627  var jSelectedRow = $(nSelectedCell).parent("tr");
628  nSelectedRow = jSelectedRow[0];
629  if (properties.fnOnDeleting(jSelectedRow, id, fnDeleteRow)) {
630  fnDeleteRow(id);
631  }
632  }
633 
634  function _fnOnDeleting(tr, id, fnDeleteRow) {
644 
645  return confirm("Are you sure that you want to delete this record?"); ;
646  }
647 
648 
649  function fnDeleteRow(id, sDeleteURL) {
655 
656  var sURL = sDeleteURL;
657  if (sDeleteURL == null) {
658  sURL = properties.sDeleteURL;
659  }
660  properties.fnStartProcessingMode();
661  var data = $.extend(properties.oDeleteParameters, { "id": id });
662  $.ajax({ 'url': sURL,
663  'type': properties.sDeleteHttpMethod,
664  'data': data,
665  "success": fnOnRowDeleted,
666  "dataType": properties.sDeleteDataType,
667  "error": function (response) {
668  properties.fnEndProcessingMode();
669  properties.fnShowError(response.responseText, "delete");
670  properties.fnOnDeleted("failure");
671 
672  }
673  });
674  }
675 
676 
677 
678  function fnOnRowDeleted(response) {
683 
684  properties.fnEndProcessingMode();
685  var oTRSelected = nSelectedRow;
686  /*
687  if (!properties.bUseKeyTable) {
688  oTRSelected = $('tr.' + properties.sSelectedRowClass, oTable)[0];
689  } else {
690  oTRSelected = $("td.focus", oTable)[0].parents("tr")[0];
691  }
692  */
693  if (response == properties.sSuccessResponse || response == "" || (response.success)) {
694  oTable.fnDeleteRow(oTRSelected);
695  fnDisableDeleteButton();
696  fnSetDisplayStart();
697  if (properties.bUseKeyTable) {
698  oTable.keys.fnSetPosition( oKeyTablePosition[0], oKeyTablePosition[1] );
699  }
700  properties.fnOnDeleted("success");
701  }
702  else {
703  properties.fnShowError(response, "delete");
704  properties.fnOnDeleted("failure");
705  }
706  }
707 
708 
709 
710  /* Function called after delete action
711  * @param result string
712  * "success" if row is actually deleted
713  * "failure" if delete failed
714  * @return void
715  */
716  function _fnOnDeleted(result) { }
717 
718  function _fnOnEditing(input) { return true; }
719  function _fnOnEdited(result, sOldValue, sNewValue, iRowIndex, iColumnIndex, iRealColumnIndex) {
720 
721  }
722 
723  function fnOnAdding() { return true; }
724  function _fnOnAdded(result) { }
725 
726  var oSettings;
727  function fnGetDisplayStart() {
728  return oSettings._iDisplayStart;
729  }
730 
731  function fnSetDisplayStart() {
735 
736  //To refresh table with preserver pagination on cell edit
737  //if (oSettings.oFeatures.bServerSide === false) {
738  oSettings._iDisplayStart = iDisplayStart;
739  oSettings.oApi._fnCalculateEnd(oSettings);
740  //draw the 'current' page
741  oSettings.oApi._fnDraw(oSettings);
742  //}
743  }
744 
745  function _fnOnBeforeAction(sAction) {
746  return true;
747  }
748 
749  function _fnOnActionCompleted(sStatus) {
750 
751  }
752 
753  function fnGetActionSettings(sAction) {
756 
757  if (properties.aoTableAction) {
758  properties.fnShowError("Configuration error - aoTableAction setting are not set", sAction);
759  }
760  var i = 0;
761 
762  for (i = 0; i < properties.aoTableActions.length; i++) {
763  if (properties.aoTableActions[i].sAction == sAction) {
764  return properties.aoTableActions[i];
765  }
766  }
767 
768  properties.fnShowError("Cannot find action configuration settings", sAction);
769  }
770 
771 
772  function fnPopulateFormWithRowCells(oForm, oTR) {
776 
777  var iRowID = oTable.fnGetPosition(oTR);
778 
779  var id = properties.fnGetRowID($(oTR));
780 
781  $(oForm).validate().resetForm();
782  jQuery.data($(oForm)[0], 'DT_RowId', id);
783  $("input.DT_RowId", $(oForm)).val(id);
784  jQuery.data($(oForm)[0], 'ROWID', iRowID);
785  $("input.ROWID", $(oForm)).val(iRowID);
786 
787 
788  var oSettings = oTable.fnSettings();
789  var iColumnCount = oSettings.aoColumns.length;
790 
791 
792  $("input:text[rel],input:radio[rel][checked],input:hidden[rel],select[rel],textarea[rel],input:checkbox[rel]",
793  $(oForm)).each(function () {
794  var rel = $(this).attr("rel");
795 
796  if (rel >= iColumnCount) {
797  properties.fnShowError("In the form is placed input element with the name '" + $(this).attr("name") + "' with the 'rel' attribute that must be less than a column count - " + iColumnCount, "action");
798  } else {
799  var sCellValue = oTable.fnGetData(oTR)[rel];
800  if (this.nodeName.toLowerCase() == "select" || this.tagName.toLowerCase() == "select") {
801 
802  if (this.multiple == true) {
803  var aoSelectedValue = new Array();
804  aoCellValues = sCellValue.split(",");
805  for (i = 0; i <= this.options.length - 1; i++) {
806  if (jQuery.inArray(this.options[i].text.toLowerCase().trim(), aoCellValues) != -1) {
807  aoSelectedValue.push(this.options[i].value);
808  }
809  }
810  $(this).val(aoSelectedValue);
811  } else {
812  for (i = 0; i <= this.options.length - 1; i++) {
813  if (this.options[i].text.toLowerCase() == sCellValue.toLowerCase()) {
814  $(this).val(this.options[i].value);
815  }
816  }
817  }
818 
819  }
820  else if (this.nodeName.toLowerCase() == "span" || this.tagName.toLowerCase() == "span") {
821  $(this).html(sCellValue);
822  } else {
823  if (this.type == "checkbox") {
824  if (sCellValue == "true") {
825  $(this).attr("checked", true);
826  }
827  } else {
828  if (this.type == "radio") {
829  if (this.value == sCellValue) {
830  this.checked = true;
831  }
832  } else {
833  this.value = sCellValue;
834  }
835  }
836  }
837 
838  //sCellValue = sCellValue.replace(properties.sIDToken, data);
839  //values[rel] = sCellValue;
840  //oTable.fnUpdate(sCellValue, iRowID, rel);
841  }
842  });
843 
844 
845 
846  } //End function fnPopulateFormWithRowCells
847 
848  function fnTakeRowDataFromFormElements(oForm) {
853 
854  var iDT_RowId = jQuery.data(oForm, 'DT_RowId');
855  var iColumnCount = oSettings.aoColumns.length;
856 
857  var values = new Array();
858  var rowData = new Object();
859 
860  $("input:text[rel],input:radio[rel][checked],input:hidden[rel],select[rel],textarea[rel],span.datafield[rel],input:checkbox[rel]", oForm).each(function () {
861  var rel = $(this).attr("rel");
862  var sCellValue = "";
863  if (rel >= iColumnCount) {
864  properties.fnShowError("In the add form is placed input element with the name '" + $(this).attr("name") + "' with the 'rel' attribute that must be less than a column count - " + iColumnCount, "add");
865  } else {
866  if (this.nodeName.toLowerCase() == "select" || this.tagName.toLowerCase() == "select") {
867  //sCellValue = $("option:selected", this).text();
868  sCellValue = $.map(
869  $.makeArray($("option:selected", this)),
870  function (n, i) {
871  return $(n).text();
872  }).join(",");
873  }
874  else if (this.nodeName.toLowerCase() == "span" || this.tagName.toLowerCase() == "span") {
875  sCellValue = $(this).html();
876  } else {
877  if (this.type == "checkbox") {
878  if (this.checked) {
879  sCellValue = (this.value != "on") ? this.value : "true";
880  } else {
881  sCellValue = (this.value != "on") ? "" : "false";
882  }
883  } else {
884  sCellValue = this.value;
885  }
886  }
887  //Deprecated
888  sCellValue = sCellValue.replace("DATAROWID", iDT_RowId);
889  sCellValue = sCellValue.replace(properties.sIDToken, iDT_RowId);
890  if (oSettings.aoColumns != null
891  && oSettings.aoColumns[rel] != null
892  && isNaN(parseInt(oSettings.aoColumns[0].mDataProp))) {
893  rowData[oSettings.aoColumns[rel].mDataProp] = sCellValue;
894  } else {
895  values[rel] = sCellValue;
896  }
897  }
898  });
899 
900  if (oSettings.aoColumns != null && isNaN(parseInt(oSettings.aoColumns[0].mDataProp))) {
901  return rowData;
902  }
903  else {
904  return values;
905  }
906 
907 
908  } //End function fnPopulateRowWithFormElements
909 
910 
911 
912 
913  function fnSendFormUpdateRequest(nActionForm) {
916 
917  var jActionForm = $(nActionForm);
918  var sAction = jActionForm.attr("id");
919 
920  sAction = sAction.replace("form", "");
921  var sActionURL = jActionForm.attr("action");
922  if (properties.fnOnBeforeAction(sAction)) {
923  if (jActionForm.valid()) {
924  iDisplayStart = fnGetDisplayStart();
925  properties.fnStartProcessingMode();
926  if (properties.bUseFormsPlugin) {
927 
928  //Still in beta(development)
929  var oAjaxSubmitOptions = {
930  success: function (response, statusString, xhr) {
931  properties.fnEndProcessingMode();
932  if (response.toLowerCase().indexOf("error") != -1 || statusString != "success") {
933  properties.fnShowError(response, sAction);
934  properties.fnOnActionCompleted("failure");
935  } else {
936  fnUpdateRowOnSuccess(nActionForm);
937  properties.fnOnActionCompleted("success");
938  }
939 
940  },
941  error: function (response) {
942  properties.fnEndProcessingMode();
943  properties.fnShowError(response.responseText, sAction);
944  properties.fnOnActionCompleted("failure");
945  }
946  };
947  var oActionSettings = fnGetActionSettings(sAction);
948  oAjaxSubmitOptions = $.extend({}, properties.oAjaxSubmitOptions, oAjaxSubmitOptions);
949  $(oActionForm).ajaxSubmit(oAjaxSubmitOptions);
950 
951  } else {
952  var params = jActionForm.serialize();
953  $.ajax({ 'url': sActionURL,
954  'data': params,
955  'type': properties.sAddHttpMethod,
956  'dataType': properties.sAddDataType,
957  success: function (response) {
958  properties.fnEndProcessingMode();
959  fnUpdateRowOnSuccess(nActionForm);
960  properties.fnOnActionCompleted("success");
961  },
962  error: function (response) {
963  properties.fnEndProcessingMode();
964  properties.fnShowError(response.responseText, sAction);
965  properties.fnOnActionCompleted("failure");
966  }
967  });
968  }
969  }
970  }
971  }
972 
973  function fnUpdateRowOnSuccess(nActionForm) {
976 
977  var values = fnTakeRowDataFromFormElements(nActionForm);
978 
979  var iRowID = jQuery.data(nActionForm, 'ROWID');
980  var oSettings = oTable.fnSettings();
981  var iColumnCount = oSettings.aoColumns.length;
982  for (var rel = 0; rel < iColumnCount; rel++) {
983  if (oSettings.aoColumns != null
984  && oSettings.aoColumns[rel] != null
985  && isNaN(parseInt(oSettings.aoColumns[0].mDataProp))) {
986  sCellValue = rowData[oSettings.aoColumns[rel].mDataProp];
987  } else {
988  sCellValue = values[rel];
989  }
990  if (sCellValue != undefined) {
991  oTable.fnUpdate(sCellValue, iRowID, rel);
992  }
993  }
994 
995  fnSetDisplayStart();
996  $(nActionForm).dialog('close');
997  return;
998 
999  }
1000 
1001 
1002  oTable = this;
1003 
1004  var defaults = {
1005 
1006  sUpdateURL: "UpdateData",
1007  sAddURL: "AddData",
1008  sDeleteURL: "DeleteData",
1009  sAddNewRowFormId: "formAddNewRow",
1010  oAddNewRowFormOptions: { autoOpen: false, modal: true },
1011  sAddNewRowButtonId: "btnAddNewRow",
1012  oAddNewRowButtonOptions: null,
1013  sAddNewRowOkButtonId: "btnAddNewRowOk",
1014  sAddNewRowCancelButtonId: "btnAddNewRowCancel",
1015  oAddNewRowOkButtonOptions: { label: "Ok" },
1016  oAddNewRowCancelButtonOptions: { label: "Cancel" },
1017  sDeleteRowButtonId: "btnDeleteRow",
1018  oDeleteRowButtonOptions: null,
1019  sSelectedRowClass: "row_selected",
1020  sReadOnlyCellClass: "read_only",
1021  sAddDeleteToolbarSelector: ".add_delete_toolbar",
1022  fnShowError: _fnShowError,
1023  fnStartProcessingMode: _fnStartProcessingMode,
1024  fnEndProcessingMode: _fnEndProcessingMode,
1025  aoColumns: null,
1026  fnOnDeleting: _fnOnDeleting,
1027  fnOnDeleted: _fnOnDeleted,
1028  fnOnAdding: fnOnAdding,
1029  fnOnNewRowPosted: _fnOnNewRowPosted,
1030  fnOnAdded: _fnOnAdded,
1031  fnOnEditing: _fnOnEditing,
1032  fnOnEdited: _fnOnEdited,
1033  sAddHttpMethod: 'POST',
1034  sAddDataType: "text",
1035  sDeleteHttpMethod: 'POST',
1036  sDeleteDataType: "text",
1037  fnGetRowID: _fnGetRowIDFromAttribute,
1038  fnSetRowID: _fnSetRowIDInAttribute,
1039  sEditorHeight: "100%",
1040  sEditorWidth: "100%",
1041  bDisableEditing: false,
1042  oDeleteParameters: {},
1043  oUpdateParameters: {},
1044  sIDToken: "DT_RowId",
1045  aoTableActions: null,
1046  fnOnBeforeAction: _fnOnBeforeAction,
1047  bUseFormsPlugin: false,
1048  fnOnActionCompleted: _fnOnActionCompleted,
1049  sSuccessResponse: "ok",
1050  sFailureResponsePrefix: "ERROR",
1051  oKeyTable: null //KEYTABLE
1052 
1053  };
1054 
1055  properties = $.extend(defaults, options);
1056  oSettings = oTable.fnSettings();
1057  properties.bUseKeyTable = (properties.oKeyTable != null);
1058 
1059  return this.each(function () {
1060  var sTableId = oTable.dataTableSettings[0].sTableId;
1061  //KEYTABLE
1062  if (properties.bUseKeyTable) {
1063  var keys = new KeyTable({
1064  "table": document.getElementById(sTableId),
1065  "datatable": oTable
1066  });
1067  oTable.keys = keys;
1068 
1069  /* Apply a return key event to each cell in the table */
1070  keys.event.action(null, null, function (nCell) {
1071  if( $(nCell).hasClass(properties.sReadOnlyCellClass)) {
1072  return;
1073  }
1074  /* Block KeyTable from performing any events while jEditable is in edit mode */
1075  keys.block = true;
1076  /* Dispatch click event to go into edit mode - Saf 4 needs a timeout... */
1077  setTimeout(function () { $(nCell).dblclick(); }, 0);
1078  //properties.bDisableEditing = true;
1079  });
1080  }
1081 
1082 
1083 
1084 
1085 
1086 
1087  //KEYTABLE
1088 
1089  if (oTable.fnSettings().sAjaxSource != null) {
1090  oTable.fnSettings().aoDrawCallback.push({
1091  "fn": function () {
1092  //Apply jEditable plugin on the table cells
1093  fnApplyEditable(oTable.fnGetNodes());
1094  $(oTable.fnGetNodes()).each(function () {
1095  var position = oTable.fnGetPosition(this);
1096  var id = oTable.fnGetData(position)[0];
1097  properties.fnSetRowID($(this), id);
1098  }
1099  );
1100  },
1101  "sName": "fnApplyEditable"
1102  });
1103 
1104  } else {
1105  //Apply jEditable plugin on the table cells
1106  fnApplyEditable(oTable.fnGetNodes());
1107  }
1108 
1109  //Setup form to open in dialog
1110  oAddNewRowForm = $("#" + properties.sAddNewRowFormId);
1111  if (oAddNewRowForm.length != 0) {
1112 
1114  var oSettings = oTable.fnSettings();
1115  var iColumnCount = oSettings.aoColumns.length;
1116  for (i = 0; i < iColumnCount; i++) {
1117  if ($("[rel=" + i + "]", oAddNewRowForm).length == 0) {
1118  properties.fnShowError("In the form that is used for adding new records cannot be found an input element with rel=" + i + " that will be bound to the value in the column " + i + ". See http://code.google.com/p/jquery-datatables-editable/wiki/AddingNewRecords#Add_new_record_form for more details", "init");
1119  }
1120  }
1121 
1122 
1123  if (properties.oAddNewRowFormOptions != null) {
1124  properties.oAddNewRowFormOptions.autoOpen = false;
1125  } else {
1126  properties.oAddNewRowFormOptions = { autoOpen: false };
1127  }
1128  oAddNewRowForm.dialog(properties.oAddNewRowFormOptions);
1129 
1130  //Add button click handler on the "Add new row" button
1131  oAddNewRowButton = $("#" + properties.sAddNewRowButtonId);
1132  if (oAddNewRowButton.length != 0) {
1133 
1134  if(oAddNewRowButton.data("add-event-attached")!="true")
1135  {
1136  oAddNewRowButton.click(function () {
1137  oAddNewRowForm.dialog('open');
1138  });
1139  oAddNewRowButton.data("add-event-attached", "true");
1140  }
1141 
1142  } else {
1143  if ($(properties.sAddDeleteToolbarSelector).length == 0) {
1144  throw "Cannot find a button with an id '" + properties.sAddNewRowButtonId + "', or placeholder with an id '" + properties.sAddDeleteToolbarSelector + "' that should be used for adding new row although form for adding new record is specified";
1145  } else {
1146  oAddNewRowButton = null; //It will be auto-generated later
1147  }
1148  }
1149 
1150  //Prevent Submit handler
1151  if (oAddNewRowForm[0].nodeName.toLowerCase() == "form") {
1152  oAddNewRowForm.unbind('submit');
1153  oAddNewRowForm.submit(function (event) {
1154  fnOnRowAdding(event);
1155  return false;
1156  });
1157  } else {
1158  $("form", oAddNewRowForm[0]).unbind('submit');
1159  $("form", oAddNewRowForm[0]).submit(function (event) {
1160  fnOnRowAdding(event);
1161  return false;
1162  });
1163  }
1164 
1165  // array to add default buttons to
1166  var aAddNewRowFormButtons = [];
1167 
1168  oConfirmRowAddingButton = $("#" + properties.sAddNewRowOkButtonId, oAddNewRowForm);
1169  if (oConfirmRowAddingButton.length == 0) {
1170  //If someone forgotten to set the button text
1171  if (properties.oAddNewRowOkButtonOptions.text == null
1172  || properties.oAddNewRowOkButtonOptions.text == "") {
1173  properties.oAddNewRowOkButtonOptions.text = "Ok";
1174  }
1175  properties.oAddNewRowOkButtonOptions.click = fnOnRowAdding;
1176  properties.oAddNewRowOkButtonOptions.id = properties.sAddNewRowOkButtonId;
1177  // push the add button onto the array
1178  aAddNewRowFormButtons.push(properties.oAddNewRowOkButtonOptions);
1179  } else {
1180  oConfirmRowAddingButton.click(fnOnRowAdding);
1181  }
1182 
1183  oCancelRowAddingButton = $("#" + properties.sAddNewRowCancelButtonId);
1184  if (oCancelRowAddingButton.length == 0) {
1185  //If someone forgotten to the button text
1186  if (properties.oAddNewRowCancelButtonOptions.text == null
1187  || properties.oAddNewRowCancelButtonOptions.text == "") {
1188  properties.oAddNewRowCancelButtonOptions.text = "Cancel";
1189  }
1190  properties.oAddNewRowCancelButtonOptions.click = fnOnCancelRowAdding;
1191  properties.oAddNewRowCancelButtonOptions.id = properties.sAddNewRowCancelButtonId;
1192  // push the cancel button onto the array
1193  aAddNewRowFormButtons.push(properties.oAddNewRowCancelButtonOptions);
1194  } else {
1195  oCancelRowAddingButton.click(fnOnCancelRowAdding);
1196  }
1197  // if the array contains elements, add them to the dialog
1198  if (aAddNewRowFormButtons.length > 0) {
1199  oAddNewRowForm.dialog('option', 'buttons', aAddNewRowFormButtons);
1200  }
1201  //Issue: It cannot find it with this call:
1202  //oConfirmRowAddingButton = $("#" + properties.sAddNewRowOkButtonId, oAddNewRowForm);
1203  //oCancelRowAddingButton = $("#" + properties.sAddNewRowCancelButtonId, oAddNewRowForm);
1204  oConfirmRowAddingButton = $("#" + properties.sAddNewRowOkButtonId);
1205  oCancelRowAddingButton = $("#" + properties.sAddNewRowCancelButtonId);
1206 
1207  if (properties.oAddNewRowFormValidation != null) {
1208  oAddNewRowForm.validate(properties.oAddNewRowFormValidation);
1209  }
1210  } else {
1211  oAddNewRowForm = null;
1212  }
1213 
1214  //Set the click handler on the "Delete selected row" button
1215  oDeleteRowButton = $('#' + properties.sDeleteRowButtonId);
1216  if (oDeleteRowButton.length != 0)
1217  {
1218  if(oDeleteRowButton.data("delete-event-attached")!="true")
1219  {
1220  oDeleteRowButton.click(_fnOnRowDelete);
1221  oDeleteRowButton.data("delete-event-attached", "true");
1222  }
1223  }
1224  else {
1225  oDeleteRowButton = null;
1226  }
1227 
1228  //If an add and delete buttons does not exists but Add-delete toolbar is specificed
1229  //Autogenerate these buttons
1230  oAddDeleteToolbar = $(properties.sAddDeleteToolbarSelector);
1231  if (oAddDeleteToolbar.length != 0) {
1232  if (oAddNewRowButton == null && properties.sAddNewRowButtonId != ""
1233  && oAddNewRowForm != null) {
1234  oAddDeleteToolbar.append("<button id='" + properties.sAddNewRowButtonId + "' class='add_row'>Add</button>");
1235  oAddNewRowButton = $("#" + properties.sAddNewRowButtonId);
1236  oAddNewRowButton.click(function () { oAddNewRowForm.dialog('open'); });
1237  }
1238  if (oDeleteRowButton == null && properties.sDeleteRowButtonId != "") {
1239  oAddDeleteToolbar.append("<button id='" + properties.sDeleteRowButtonId + "' class='delete_row'>Delete</button>");
1240  oDeleteRowButton = $("#" + properties.sDeleteRowButtonId);
1241  oDeleteRowButton.click(_fnOnRowDelete);
1242  }
1243  }
1244 
1245  //If delete button exists disable it until some row is selected
1246  if (oDeleteRowButton != null) {
1247  if (properties.oDeleteRowButtonOptions != null) {
1248  oDeleteRowButton.button(properties.oDeleteRowButtonOptions);
1249  }
1250  fnDisableDeleteButton();
1251  }
1252 
1253  //If add button exists convert it to the JQuery-ui button
1254  if (oAddNewRowButton != null) {
1255  if (properties.oAddNewRowButtonOptions != null) {
1256  oAddNewRowButton.button(properties.oAddNewRowButtonOptions);
1257  }
1258  }
1259 
1260 
1261  //If form ok button exists convert it to the JQuery-ui button
1262  if (oConfirmRowAddingButton != null) {
1263  if (properties.oAddNewRowOkButtonOptions != null) {
1264  oConfirmRowAddingButton.button(properties.oAddNewRowOkButtonOptions);
1265  }
1266  }
1267 
1268  //If form cancel button exists convert it to the JQuery-ui button
1269  if (oCancelRowAddingButton != null) {
1270  if (properties.oAddNewRowCancelButtonOptions != null) {
1271  oCancelRowAddingButton.button(properties.oAddNewRowCancelButtonOptions);
1272  }
1273  }
1274 
1275  // AndrewFix
1276  // $('tr', dt.nTBody).live( 'click', function(e) {
1277  // $(dt.nTBody).on('click', 'tr', function(e) {
1278 
1279  //Add handler to the inline delete buttons
1280  //$(".table-action-deletelink", oTable).live("click", _fnOnRowDeleteInline); // backup
1281  $(oTable).on("click", '.table-action-deletelink', _fnOnRowDeleteInline);
1282 
1283  if (!properties.bUseKeyTable) {
1284  //Set selected class on row that is clicked
1285  //Enable delete button if row is selected, disable delete button if selected class is removed
1286  $("tbody", oTable).click(function (event) {
1287  if ($(event.target.parentNode).hasClass(properties.sSelectedRowClass)) {
1288  $(event.target.parentNode).removeClass(properties.sSelectedRowClass);
1289  if (oDeleteRowButton != null) {
1290  fnDisableDeleteButton();
1291  }
1292  } else {
1293  $(oTable.fnSettings().aoData).each(function () {
1294  $(this.nTr).removeClass(properties.sSelectedRowClass);
1295  });
1296  $(event.target.parentNode).addClass(properties.sSelectedRowClass);
1297  if (oDeleteRowButton != null) {
1298  fnEnableDeleteButton();
1299  }
1300  }
1301  });
1302  } else {
1303  oTable.keys.event.focus(null, null, function (nNode, x, y) {
1304 
1305  });
1306  }
1307 
1308  if (properties.aoTableActions != null) {
1309  for (var i = 0; i < properties.aoTableActions.length; i++) {
1310  var oTableAction = $.extend({ sType: "edit" }, properties.aoTableActions[i]);
1311  var sAction = oTableAction.sAction;
1312  var sActionFormId = oTableAction.sActionFormId;
1313 
1314  var oActionForm = $("#form" + sAction);
1315  if (oActionForm.length != 0) {
1316  var oFormOptions = { autoOpen: false, modal: true };
1317  oFormOptions = $.extend({}, oTableAction.oFormOptions, oFormOptions);
1318  oActionForm.dialog(oFormOptions);
1319  oActionForm.data("action-options", oTableAction);
1320 
1321  var oActionFormLink = $(".table-action-" + sAction);
1322  if (oActionFormLink.length != 0) {
1323 
1324  // AndrewFix
1325  // $('tr', dt.nTBody).live( 'click', function(e) {
1326  // $(dt.nTBody).on('click', 'tr', function(e) {
1327 
1328  // oActionFormLink.live("click", function () // backup
1329  oActionFormLink.on("click", function () {
1330 
1331 
1332  var sClass = this.className;
1333  var classList = sClass.split(/\s+/);
1334  var sActionFormId = "";
1335  var sAction = "";
1336  for (i = 0; i < classList.length; i++) {
1337  if (classList[i].indexOf("table-action-") > -1) {
1338  sAction = classList[i].replace("table-action-", "");
1339  sActionFormId = "#form" + sAction;
1340  }
1341  }
1342  if (sActionFormId == "") {
1343  properties.fnShowError("Cannot find a form with an id " + sActionFormId + " that should be associated to the action - " + sAction, sAction)
1344  }
1345 
1346  var oTableAction = $(sActionFormId).data("action-options");
1347 
1348  if (oTableAction.sType == "edit") {
1349 
1350  //var oTD = ($(this).parents('td'))[0];
1351  var oTR = ($(this).parents('tr'))[0];
1352  fnPopulateFormWithRowCells(oActionForm, oTR);
1353  }
1354  $(oActionForm).dialog('open');
1355  });
1356  }
1357 
1358  oActionForm.submit(function (event) {
1359 
1360  fnSendFormUpdateRequest(this);
1361  return false;
1362 
1363  });
1364 
1365 
1366  var aActionFormButtons = new Array();
1367 
1368  //var oActionSubmitButton = $("#form" + sAction + "Ok", oActionForm);
1369  //aActionFormButtons.push(oActionSubmitButton);
1370  var oActionFormCancel = $("#form" + sAction + "Cancel", oActionForm);
1371  if (oActionFormCancel.length != 0) {
1372  aActionFormButtons.push(oActionFormCancel);
1373  oActionFormCancel.click(function () {
1374 
1375  var oActionForm = $(this).parents("form")[0];
1376  //Clear the validation messages and reset form
1377  $(oActionForm).validate().resetForm(); // Clears the validation errors
1378  $(oActionForm)[0].reset();
1379 
1380  $(".error", $(oActionForm)).html("");
1381  $(".error", $(oActionForm)).hide(); // Hides the error element
1382  $(oActionForm).dialog('close');
1383  });
1384  }
1385 
1386  //Convert all action form buttons to the JQuery UI buttons
1387  $("button", oActionForm).button();
1388  /*
1389  if (aActionFormButtons.length > 0) {
1390  oActionForm.dialog('option', 'buttons', aActionFormButtons);
1391  }
1392  */
1393 
1394 
1395 
1396  }
1397 
1398 
1399 
1400 
1401  } // end for (var i = 0; i < properties.aoTableActions.length; i++)
1402  } //end if (properties.aoTableActions != null)
1403 
1404 
1405  });
1406  };
1407 })(jQuery);
1408 
int s
The socket that the CLI will use to communicate.
Definition: fo_cli.c:48
int response
Is a response expected from the scheduler.
Definition: fo_cli.c:47