Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. {% extends 'layout_1_column' %}
  2.  
  3. {% block main %}
  4.  
  5. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.10.16/datatables.min.css"/>
  6. <script type="text/javascript" src="https://cdn.datatables.net/v/bs/dt-1.10.16/datatables.min.js"></script>
  7.  
  8.  
  9. {% include 'entity_list' key:page.adx_entitylist.id %}
  10.  
  11.  
  12. {% fetchxml my_query %}
  13. <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  14. <entity name="new_inquiry">
  15. <attribute name="new_name" />
  16. <attribute name="statuscode" />
  17. <attribute name="new_response" />
  18. <attribute name="new_question" />
  19. <attribute name="new_inquiryid" />
  20. <order attribute="new_name" descending="false" />
  21. <filter type="and">
  22. <condition attribute="statecode" operator="eq" value="0" />
  23. </filter>
  24. </entity>
  25. </fetch>
  26. {% endfetchxml %}
  27.  
  28.  
  29. <div name="content" style="padding: 15px 30px 0 0; clear: both;">
  30. <table id="example" class="display table table-striped table-bordered" style="width:100%">
  31.  
  32.  
  33. <thead>
  34. <tr>
  35. <th>Id</th>
  36. <th>Status Code</th>
  37. <th>Question</th>
  38. <th>Response</th>
  39.  
  40. </tr>
  41. </thead>
  42. <tbody>
  43. {% for result in my_query.results.entities %}
  44. <tr style="cursor: pointer;">
  45. <td>{{ result.new_inquiryid }}</th>
  46. <td>{{ result.new_name | escape }}</td>
  47. <td>{{ result.new_question }}</td>
  48. <td>{{ result.new_response }}</td>
  49. </tr>
  50. {% endfor %}
  51.  
  52. </tbody>
  53.  
  54. <tfoot>
  55. <tr>
  56. <td>Id</th>
  57. <th>Name</th>
  58. <th>Question</th>
  59. <th>Response</th>
  60.  
  61. </tr>
  62. </tfoot>
  63. </table>
  64. <div class="clear"></div>
  65. </div>
  66.  
  67.  
  68.  
  69.  
  70. </div>
  71.  
  72.  
  73. </div>
  74.  
  75. <script>
  76. $(document).ready(function() {
  77.  
  78.  
  79.  
  80. var table = $('#example').DataTable( {
  81. //"pageLength": 2,
  82. "columnDefs": [
  83. {
  84. "targets": [ 0 ],
  85. "visible": false,
  86. "searchable": false
  87. }
  88.  
  89. ]
  90. });
  91.  
  92.  
  93. $('#example tbody').on( 'click', 'tr', function () {
  94. var id = table.row( this ).data()[0];
  95.  
  96. console.log( 'Clicked row id '+id );
  97. window.location.href = "/inquiries/inquiry-create/?id="+id;
  98.  
  99. } );
  100.  
  101. $('#button').click( function () {
  102. table.row('.selected').remove().draw( false );
  103. } );
  104. } );
  105.  
  106.  
  107. </script>
  108.  
  109. {% endblock %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement