Open OzanKurt opened 3 months ago
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 serverSide: false
by default when rows are used.
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
}
Issues
2 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
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 serverSide(false)
.
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
Builder
class so that we can make it fill thetbody
IF theserverSide
option is disabled.Here is an example DataTable I've prepared along with 2 methods
makingRowExample
andmakingCellExample
explaining how theRow
andCell
classes apis work. I tried to make things similar to theColumn
class which we already.There area a couple important places I've marked via comments inside the code.