Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. var $table = $('#table'),
  2. $remove = $('#remove'),
  3. selections = [];
  4.  
  5. function initTable() {
  6. $table.bootstrapTable({
  7. height: getHeight(),
  8. columns: [
  9. [
  10. {
  11. field: 'state',
  12. checkbox: true,
  13. rowspan: 2,
  14. align: 'center',
  15. valign: 'middle'
  16. }, {
  17. title: 'Item ID',
  18. field: 'id',
  19. rowspan: 2,
  20. align: 'center',
  21. valign: 'middle',
  22. sortable: true,
  23. footerFormatter: totalTextFormatter
  24. }, {
  25. title: 'Item Detail',
  26. colspan: 3,
  27. align: 'center'
  28. }
  29. ],
  30. [
  31. {
  32. field: 'name',
  33. title: 'Item Name',
  34. sortable: true,
  35. editable: true,
  36. footerFormatter: totalNameFormatter,
  37. align: 'center'
  38. }, {
  39. field: 'price',
  40. title: 'Item Price',
  41. sortable: true,
  42. align: 'center',
  43. editable: {
  44. type: 'text',
  45. title: 'Item Price',
  46. validate: function (value) {
  47. value = $.trim(value);
  48. if (!value) {
  49. return 'This field is required';
  50. }
  51. if (!/^$/.test(value)) {
  52. return 'This field needs to start width $.'
  53. }
  54. var data = $table.bootstrapTable('getData'),
  55. index = $(this).parents('tr').data('index');
  56. console.log(data[index]);
  57. return '';
  58. }
  59. },
  60. footerFormatter: totalPriceFormatter
  61. }, {
  62. field: 'operate',
  63. title: 'Item Operate',
  64. align: 'center',
  65. events: operateEvents,
  66. formatter: operateFormatter
  67. }
  68. ]
  69. ]
  70. });
  71.  
  72. var $table = $('#table');
  73.  
  74. $table.bootstrapTable({...});
  75.  
  76. $.prototype.nomeDeUmaFuncao = function() { console.log('teste nova custom function do JQuery'); };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement