File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -274,8 +274,16 @@ protected function makeDataScript(array $data)
274
274
*/
275
275
public function asOptions ()
276
276
{
277
- $ this ->setTemplate ('datatables::options ' );
277
+ return $ this ->setTemplate ('datatables::options ' );
278
+ }
278
279
279
- return $ this ;
280
+ /**
281
+ * Wrap dataTable scripts with a function.
282
+ *
283
+ * @return $this
284
+ */
285
+ public function asFunction ()
286
+ {
287
+ return $ this ->setTemplate ('datatables::function ' );
280
288
}
281
289
}
Original file line number Diff line number Diff line change
1
+ window.dtx = window.dtx || {};
2
+ window.dtx["%1$s"] = function() {
3
+ window.LaravelDataTables = window.LaravelDataTables || {};
4
+ @if (isset ($editors ) )
5
+ @foreach ($editors as $editor )
6
+ var {{ $editor -> instance } } = window.LaravelDataTables["%1$s-{{ $editor -> instance } } "] = new $.fn.dataTable.Editor({!! $editor -> toJson () ! !} );
7
+ {!! $editor -> scripts ! !}
8
+ @foreach ((array ) $editor -> events as $event )
9
+ {{ $editor -> instance } } .on('{!! $event [' event' ] ! !} ', {!! $event [' script' ] ! !} );
10
+ @endforeach
11
+ @endforeach
12
+ @endif
13
+ return $("#%1$s").DataTable(%2$s);
14
+ }
You can’t perform that action at this time.
0 commit comments