MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 258 forks source link

Passing param from blade to be used as a link var. #442

Open shaneburrell opened 2 years ago

shaneburrell commented 2 years ago

I've run into an issue that may be solvable with the exsisting infrastructure but I don't readily see how to do this.

I have a List of IDs and Names that I have working with the datatable along with a Unrelated ID that i need to pass into the link so that I can add the proper record.

For example:

I am at a customer screen with ID 000001 which is the customer ID. I am showing a list of potential contacts I would like to associate with this customer from a link in a datatable with just columns of the contacts. How might be the cleanest way to get the customer ID on the link inside the datatable?

I was able to do something like this below which got me 90% there, then I realize the link builder only allows named columns.

In the columns table class:

(new LabelColumn()) ->label('Customer ID') ->content($this->params),

And in the blade file

This does work to the point of getting the customer id on the datatable but there is no way to use the param in the link I can see. TIA