-
-
Notifications
You must be signed in to change notification settings - Fork 65
Ability to use static data (no server-side) #221
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
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
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.