F
Filamentβ€’2y ago
Mehmet K.

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
toeknee
toekneeβ€’2y ago
I would suggest you use a view method and then render the view as you want it
Mehmet K.
Mehmet K.OPβ€’2y ago
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?
toeknee
toekneeβ€’2y ago
Just build it with html / tailwind css and render it as normal
Mehmet K.
Mehmet K.OPβ€’2y ago
How can I send the data in the table to this form?
Mehmet K.
Mehmet K.OPβ€’2y ago
I don't understand why he's doing this.
toeknee
toekneeβ€’2y ago
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
Mehmet K.
Mehmet K.OPβ€’2y ago
Can you give me an example?
Mehmet K.
Mehmet K.OPβ€’2y ago
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.
krekas
krekasβ€’2y ago
you returning view and same layout? wtf?
Mehmet K.
Mehmet K.OPβ€’2y ago
I want to show the table structure of normal filament as it is.
awcodes
awcodesβ€’2y ago
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
krekas
krekasβ€’2y ago
is it in admin panel or no? and you can't use view and same layout
Mehmet K.
Mehmet K.OPβ€’2y ago
I use it this way, but I wonder if I'm doing it wrong Call to a member function table() on string
awcodes
awcodesβ€’2y ago
Sorry, not getting much from the screen shot.
Mehmet K.
Mehmet K.OPβ€’2y ago
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.
awcodes
awcodesβ€’2y ago
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.
Mehmet K.
Mehmet K.OPβ€’2y ago
Route [show_barcode] not defined. I apologise it's almost evening here πŸ™‚ I use it this way but I get a route undefined error
awcodes
awcodesβ€’2y ago
Instead of route there you would use your OrderResource::getUrl() OrderResource::getUrl('show_barcode', ['barcode_number' => $record->barcode_number]) something like that?
Mehmet K.
Mehmet K.OPβ€’2y ago
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.
krekas
krekasβ€’2y ago
have you imported the ordersresource? better don't screenshot parts of the code, show everything with proper formatting
awcodes
awcodesβ€’2y ago
something 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.
Mehmet K.
Mehmet K.OPβ€’2y ago
awcodes
awcodesβ€’2y ago
maybe provide it in a gist so it's easier to look at too.
Mehmet K.
Mehmet K.OPβ€’2y ago
Mehmet K.
Mehmet K.OPβ€’2y ago
I've figured it out now, I'm so sorry. I wrote Orders instead of OrdersResource:(
awcodes
awcodesβ€’2y ago
was just about to say that. this is why full code helps to answer questions. πŸ™‚
Mehmet K.
Mehmet K.OPβ€’2y ago
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.
awcodes
awcodesβ€’2y ago
since this is a custom page you still need to implement the HasTables trait and use InteractsWithTables
Mehmet K.
Mehmet K.OPβ€’2y ago
do I need to do it this way I couldn't see anything on the screen anyway
awcodes
awcodesβ€’2y ago
yes, and your blade view should have {{ $this->table }} in it.
Mehmet K.
Mehmet K.OPβ€’2y ago
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.
awcodes
awcodesβ€’2y ago
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.
Mehmet K.
Mehmet K.OPβ€’2y ago
I sent it directly for testing, but this first error I got came up again
awcodes
awcodesβ€’2y ago
remove the layout() on the view.
Mehmet K.
Mehmet K.OPβ€’2y ago
I'm really tired. Why is he doing this, he's not really coming.
awcodes
awcodesβ€’2y ago
maybe come back to it tomorrow with a fresh perspective.
toeknee
toekneeβ€’2y ago
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.
Want results from more Discord servers?
Add your server