Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b04e49

Browse files
committed
Add template and method to wrap scripts with a function.
1 parentf9e640b commit6b04e49

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

‎src/Html/Builder.php‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,16 @@ protected function makeDataScript(array $data)
274274
*/
275275
publicfunctionasOptions()
276276
{
277-
$this->setTemplate('datatables::options');
277+
return$this->setTemplate('datatables::options');
278+
}
278279

279-
return$this;
280+
/**
281+
* Wrap dataTable scripts with a function.
282+
*
283+
* @return $this
284+
*/
285+
publicfunctionasFunction()
286+
{
287+
return$this->setTemplate('datatables::function');
280288
}
281289
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
window.dtx = window.dtx || {};
2+
window.dtx["%1$s"] = function() {
3+
window.LaravelDataTables = window.LaravelDataTables || {};
4+
@if(isset($editors))
5+
@foreach($editorsas$editor)
6+
var{{$editor->instance}} = window.LaravelDataTables["%1$s-{{$editor->instance}}"] = new $.fn.dataTable.Editor({!!$editor->toJson()!!});
7+
{!!$editor->scripts!!}
8+
@foreach((array)$editor->eventsas$event)
9+
{{$editor->instance}}.on('{!!$event['event']!!}',{!!$event['script']!!});
10+
@endforeach
11+
@endforeach
12+
@endif
13+
return $("#%1$s").DataTable(%2$s);
14+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp