暫無描述
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

editor.title.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Use a field as a grouping title for other fields. This provides the end
  3. * user with easy to understand grouping.
  4. *
  5. * Fields defined with this type are not submitted to the server, but they do
  6. * need to be initialised as normal using `e-api add()` or `e-init fields`.
  7. *
  8. * @name Field set title
  9. * @summary Field grouping display
  10. *
  11. * @scss editor.title.scss
  12. *
  13. * @example
  14. *
  15. * new $.fn.dataTable.Editor( {
  16. * "ajax": "php/dates.php",
  17. * "table": "#staff",
  18. * "fields": [ {
  19. * "label": "Personal information",
  20. * "name": "pinfo",
  21. * "type": "title"
  22. * },
  23. * // additional fields...
  24. * ]
  25. * } );
  26. */
  27. (function( factory ){
  28. if ( typeof define === 'function' && define.amd ) {
  29. // AMD
  30. define( ['jquery', 'datatables', 'datatables-editor'], factory );
  31. }
  32. else if ( typeof exports === 'object' ) {
  33. // Node / CommonJS
  34. module.exports = function ($, dt) {
  35. if ( ! $ ) { $ = require('jquery'); }
  36. factory( $, dt || $.fn.dataTable || require('datatables') );
  37. };
  38. }
  39. else if ( jQuery ) {
  40. // Browser standard
  41. factory( jQuery, jQuery.fn.dataTable );
  42. }
  43. }(function( $, DataTable ) {
  44. 'use strict';
  45. if ( ! DataTable.ext.editorFields ) {
  46. DataTable.ext.editorFields = {};
  47. }
  48. var _fieldTypes = DataTable.Editor ?
  49. DataTable.Editor.fieldTypes :
  50. DataTable.ext.editorFields;
  51. _fieldTypes.title = {
  52. create: function ( field ) { return $('<div/>')[0]; },
  53. get: function ( field ) { return ''; },
  54. set: function ( field, val ) {}
  55. };
  56. }));