Ability to use static data (no server-side)#221
Ability to use static data (no server-side)#221OzanKurt wants to merge 2 commits intoyajra:masterfrom
Conversation
|
Hello @yajra , Could you please have a look at this and share me your feedback? Here I also added the basic usage of the datatable for the controller and the blade parts. class TestController extends Controller
{
public function test()
{
$dataTable = new ExampleStaticDataTable();
return view('test')->with([
'dataTable' => $dataTable->html(),
]);
}
}{!! $dataTable->table() !!}
{!! $dataTable->scripts() !!} |
|
hey @yajra, could you please review this? |
|
@OzanKurt this is a great feature, thanks for sending the PR. I will test this as soon as I can. One thing I noticed is that maybe we can simplify the syntax further by setting public function html(): Builder
{
return $this
->builder()
->rows($this->buildRows()) -- calling this will set serverSide to false
->serverSide(false); -- so we can remove this line
} |
Co-authored-by: Arjay Angeles <aqangeles@gmail.com>
|
|
Automatically calling serverSide(false) makes so much sense! In addition to this I am currently working on the option to load the initial data from ajax while having I will send a new update in a couple days. |
|
Thanks for the updates, let me know if this is ready for review again. |



I recently wanted to use the package for a "array based datatable".
Sadly when I do;
it doesn't generate the tables body.
I added some logic to the
Builderclass so that we can make it fill thetbodyIF theserverSideoption is disabled.Here is an example DataTable I've prepared along with 2 methods
makingRowExampleandmakingCellExampleexplaining how theRowandCellclasses apis work. I tried to make things similar to theColumnclass which we already.There area a couple important places I've marked via comments inside the code.