Last active
August 29, 2015 14:07
-
-
Save saaiful/0e6ababbac5ea9229081 to your computer and use it in GitHub Desktop.
Datatable Laravel JS Fix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
jQuery(document).ready(function(){ | |
// dynamic table | |
oTable = jQuery('#{{ $id }}').dataTable({ | |
@foreach ($options as $k => $o) | |
{{ json_encode($k) }}: @if(!is_array($o)) @if(preg_match("/function/", $o)) {{ $o }} @else {{ json_encode($o) }}, @endif | |
@else | |
[{ | |
@foreach ($o as $x => $r) | |
{{ json_encode($x) }}: @if(is_array($r)) {{ json_encode($r) }}, @elseif(preg_match("/function/", $r)) {{ $r }}, @else {{ json_encode($r) }} @endif | |
@endforeach | |
}], | |
@endif | |
@endforeach | |
@foreach ($callbacks as $k => $o) | |
{{ json_encode($k) }}: {{ $o }}, | |
@endforeach | |
}); | |
// custom values are available via $values array | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment