How can I make the Data only display table?
When I press the action method, how can I create a table where the products belonging to this barcode number will be listed and how can I give the link? I need to create a table like in this picture according to the incoming barcode number, but I didn't know how to do it.
37 Replies
I would suggest you use a view method and then render the view as you want it
I am trying to create it with livewire, but I have no idea how to add the table here, can you help me as in filament?
Just build it with html / tailwind css and render it as normal
How can I send the data in the table to this form?
I don't understand why he's doing this.
You can use a filament table in the model last time I checked. You could try creating a custom livewire component which implements a table then render the livewire component within the view
Can you give me an example?
https://github.com/filamentphp/filament/edit/2.x/packages/tables/docs/02-getting-started.md I'm trying to do it according here, but it's not working.
GitHub
Build software better, together
GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 330 million projects.
you returning view and same layout? wtf?
I want to show the table structure of normal filament as it is.
If you're trying to do a page inside the admin panel then you'll need to create a custom page. https://filamentphp.com/docs/2.x/admin/resources/custom-pages
is it in admin panel or no?
and you can't use view and same layout
I use it this way, but I wonder if I'm doing it wrong Call to a member function table() on string
Sorry, not getting much from the screen shot.
I want to add the customPage link here to list the tables, I also want to send the barcode_number, but I couldn't add it here.
Maybe it's just because it's early here and my brain isn't working yet, but in the OrderResource::getUrl() params you're just passing a string of 'records'. Shouldn't that be your barcode_number? And you should probably put that in an Action like your other ones.
Route [show_barcode] not defined.
I apologise it's almost evening here π I use it this way but I get a route undefined error
Instead of route there you would use your OrderResource::getUrl()
OrderResource::getUrl('show_barcode', ['barcode_number' => $record->barcode_number])
something like that?Action::make('Barkod Bas2')->icon('heroicon-o-office-building')
->url(fn(Orders $record): string => OrdersResource::getUrl('show_barcode', ['barcode_number' => $record->barcode_number]))
->openUrlInNewTab(), that's the way I think. Call to undefined method App\Models\Orders::getUrl()
this error returns.
have you imported the
ordersresource
?
better don't screenshot parts of the code, show everything with proper formattingsomething else is definitely off if it's trying to call getUrl() on the Orders Model
as @krekas said, it seems like we're going to need more context like, the whole file.
maybe provide it in a gist so it's easier to look at too.
I've figured it out now, I'm so sorry. I wrote Orders instead of OrdersResource:(
was just about to say that.
this is why full code helps to answer questions. π
I was going to ask one more thing, but can't I show the table on the screen in this way?It comes this way, but I wonder if I've forgotten something again.
since this is a custom page you still need to implement the HasTables trait and use InteractsWithTables
do I need to do it this way I couldn't see anything on the screen anyway
yes, and your blade view should have {{ $this->table }} in it.
This time I'm in trouble with this place π I'm trying to get it from Parent, it doesn't work, I'm trying to get it directly from Orders, it doesn't accept it either.
try dropping the mount() function. you don't need it. when you override it like that you are loosing the mount functionality from the Page Component.
I sent it directly for testing, but this first error I got came up again
remove the layout() on the view.
I'm really tired. Why is he doing this, he's not really coming.
maybe come back to it tomorrow with a fresh perspective.
Make sure you are return the parent::getTableQuery() with your additions, since no selects will be in your query I suspect as you are overriding it.