Advertisement
Guest User

Untitled

a guest
Oct 1st, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.06 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(function(){
  3. $("#accord").css("width", $('.row').width()-45);
  4. $("#dg").css("width", $('.row').width()-45);
  5. $('#error').hide();
  6. $('#from').val('');
  7. $('#to').val('');
  8. $('#dg').datagrid({
  9.  
  10. pageSize: 50,
  11. pageList: [50,100,150,200],
  12. view: detailview,
  13. detailFormatter:function(index,row){
  14. return '<div class="ddv" style="padding:5px 0"></div>';
  15. },
  16. onCollapseRow: function(index,row){
  17. alert('test');
  18. },
  19. rowStyler:function(index,row){
  20. if (row.id>-1){
  21. return 'background-color:white;color:blue;font-weight:bold;';
  22. }
  23. if (row.id=1){
  24. return 'background-color:white;color:blue;font-weight:bold;';
  25. }
  26. if (row.id=-1){
  27. $('#dg').datagrid('reload');
  28. $('#error').show();
  29. $.messager.show({
  30. title:'Response',
  31. msg:'Brak zwróconych wyników szukania'
  32. })
  33. }
  34. },
  35. onExpandRow: function(index,row){
  36. $('#jloading').html('<img src="themes/default/images/loading.gif">');
  37. var ddv = $(this).datagrid('getRowDetail',index).find('div.ddv');
  38. ddv.panel({
  39. height:1,
  40. border:true,
  41. cache:false,
  42. href:'listdetail.php?listnumb='+row.number,
  43. onLoad:function(){
  44. $('#dg').datagrid('fixDetailRowHeight',index);
  45. }
  46. });
  47. $('#dg').datagrid('fixDetailRowHeight',index);
  48. $.ajax({
  49. type: "GET",
  50. url: 'listdetail.php?listnumb='+row.number,
  51. success: function (d) {
  52. // replace div's content with returned data
  53. $('#jloading').html(d);
  54. }
  55. });
  56. $.ajax({
  57. type: "GET",
  58. url: 'listdetailsub.php?listnumb='+row.number,
  59. success: function (d) {
  60. // replace div's content with returned data
  61. $('#jinner').html(d);
  62. }
  63. });
  64. },
  65.  
  66. onLoadSuccess:function(){
  67. $(this).datagrid('getPanel').find('.deleter').each(function(){
  68. $(this).linkbutton({
  69. onClick:function(){
  70. var id = $(this).attr('row-id');
  71. // destroy the row
  72. if (id){
  73. $.messager.confirm('Confirm','Are you sure you want to destroy this user?',function(r){
  74. if (r){
  75. //
  76. $.post('ajax/removelist.php',{entryid:id},function(result){
  77.  
  78. if (result.success){
  79. $.messager.show({ // show error message
  80. title: 'Sukcess',
  81. timeout:10000,
  82. msg: result.LHN+'<br>'+result.List+'<br>'+result.Numb
  83. });
  84. $('#dg').datagrid('reload'); // reload the user data
  85. } else {
  86. $.messager.show({ // show error message
  87. title: 'Error',
  88. timeout:10000,
  89. msg: result
  90. });
  91. }
  92. },'json');
  93. //
  94. }
  95. });
  96. }
  97. }
  98. })
  99. })
  100. }
  101. });
  102. });
  103. function doSearch(){
  104. $('#error').hide();
  105. $('#dg').datagrid('load',{
  106. number: $('#number').val(),
  107. from: $('#from').val(),
  108. to: $('#to').val()
  109. });
  110. $('#from').val('');
  111. $('#to').val('');
  112. $('#number').val('');
  113. }
  114.  
  115.  
  116. function formatDetail(value,row){
  117. var href = 'landing.php?do=innerlist&list='+row.id+'&ln='+row.number;
  118. return '<center><a target="_blank" href="' + href + '" style="padding-right: 10px;"><span class="btn btn-primary btn-xs"><i class="fa fa-search"></i> Podgląd</span></a><a target="_blank" href="parse/dync.php?list='+row.number+'"><span class="btn btn-danger btn-xs"><i class="fa fa-file-pdf-o"></i> Pobierz</span></a><a style="padding-right: 10px;" class="deleter" href="#" row-id="'+row.id+'"><span class="btn btn-info btn-xs"><i class="fa fa-trash-o">Usuń<span></a></center>';
  119. }
  120. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement