Adam Holmes
Prepopulate constraints
When using constraints in a table filter like here: https://filamentphp.com/docs/3.x/tables/filters/query-builder is it possible to pre-populate the filters?
I looked at doing it via query string, but because the constraints are dynamic it doesn't look like it'll work
I have a table full of data and I'd like to "guess" which record the user wants to see by some filtering across multiple fields. I'm avoiding modifying the query of the table so that users have access to all the records.
Thanks
6 replies
Actions in table column view not triggering
Hi,
TLDR; Action in table
ViewColumn
doesn't do anything when clicked
I've got a ManageRelatedRecords
page - lets call it "Activity". On my activity page I have a table that displays rows of items that can be of different types. One of the columns is a ViewColumn
and depending on the type, it shows different content in the view.
In that view, I have an action to view more info. I've followed the docs here: https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component#adding-the-action and my action appears on screen, but when I click it, nothing happens.
In my table:
In the ManageRelatedRecords
page I have my action
In my activity-details
view I have
I've spent a while debugging this but I'm at a loss as to why it's not working. Any help appreciated
Cheers14 replies
Have to click action twice in component
Hi all,
Strange one - I have a table with an action. The action opens up my livewire component, which just contains a table (for now). The table in the component then has it's own actions (attach) with requires confirmation set.
The issue I have is that I have to click the attach action twice in order for the confirmation to appear. As you can see in the video, the loading icon spins and then it does nothing. If I click again, it works as it should.
The first action looks like this:
This looks at my component view
Which loads my livewire component
AttachModal
where a table()
method is used to generate the table with an action which is simply
and a render()
method
I found I had to register the component in the AppServiceProvider
too
I guess the 2 questions are:
1. Is this the correct way to add custom components to filament?
2. What's causing me having to click on the attach
action twice for the confirmation to appear?
Thanks!17 replies
Modal closing on search
I have a modal which loads a component which includes a filament table. Some fields are searchable. When I type to search, the table is automatically updated ✅ However, if I type a search term and hit enter, the modal is closed ❌
I set all the following options to prove none of them are triggering it, but it still closes.
Initial findings suggest calling
halt()
on the action, but as it's a search field in the filament table I don't have access to it
Any ideas?
Thanks6 replies
Inject other field state into viewData on ViewField
Hi,
I have a field that is
ToggleButtons
. I then have another field which is a ViewField
which I would like to regenerate depending on the option that is selected in the ToggleButtons
field.
At the moment, the way that I do this is to use $getRecord()
in the view and then look at the value in the toggle field. The problem is that it only updates when the record is saved (as you would expect).
I'd like to look at the state as is in the form before saving but I can't find a way to do this because view
and viewData
do not accept a closure for me to pass Get $get
into it. I did attempt to find the field based on the $form
using getComponent
but with no luck
Any ideas on a simple solution for this?
Thanks8 replies
SlideOver or EditPage
Hi all,
I have the scenario where I have a resource that has an index, create and edit page. On the edit page I have a couple of relation managers. In my table on the index page I would like that when clicking the row, I go to the edit page, but when I click the EditAction then a slideOver appears (with the form).
From what I've tested, it seems that slideOver only works on the action when you DON'T have an edit page. Is there a way around this?
I suppose you could argue that when clicking the table row, it should go to a view page and not an edit page, but that's not what I wan't.
Cheers
Adam
4 replies
Filament table in Modal - livewire component
Hi, this is what I'm looking to do:
1. An edit page as part of a resource - lets call that
Foo
✅
2. On that edit page, have an action in the header to select a Bar
✅
3. When clicking that action, open a modal which has a table on it (and potentially a form at the top in future) ❌
I've done steps 1 and 2 and I've managed to get a modal to open in step 3.
I've created a livewire component to display the table in the modal and a view that includes the component too.
EditFoo.php
SelectBarModal.php
select-bar-modal.blade.php
<x-filament::modal id="selectBarModal" width="lg" wire:model.defer="showingSelectBarModal">
<form wire:submit.prevent="selectBar">
@livewire('select-bar-modal')
<x-slot name="header">
<x-filament::input type="search" wire:model="search" placeholder="Search bars..." />
</x-slot>
</form>
</x-filament::modal>
I'm not sure if I'm missing a step or if I've added too much. I'm currently receiving the error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '1024' frame
which points to Bar::query
in the component class.
Any thoughts would be greatly appreciated.4 replies
Prompt input via modal on save
Hi,
I have a status field on a form which is a
ToggleButton
populated by an enum. I would like to add some functionality so that when I save the form, if this field has changed to a specific option then a modal should appear and the user should enter a reason (which is just a text area).
I would like the reason to save into a different database table as the form I'm on because I'd like to save individual rows for each change so that I can report on all the changes later (rather than overwriting the reason each time).
I'm at a real loss of how to make this happen as I'm fairly new to filament.
I managed to make it overwrite the data on the same model but hiding / showing a field, but that's not what I want - I want a modal to popup on save. I also tried to add a relationship to a Group
but that is still a HasOne
where I would like a HasMany
.
Any ideas or pointers in the right direction would be much appreciated.
Thanks7 replies
Testing form with relationships
Hi,
I'm attempting to test a create form for my Users page. The form has basic info on, as well as a roles dropdown which uses filament-shield. When using the UI, everything works fine. When I run the test to make sure there are no errors, the test fails with the following and I can't work out why:
Test
Factory
Roles dropdown in form schema
TIA, Adam
3 replies
editOptionForm with permissions
Hi,
I have a select form component which uses a relationship to look at another model. I use
editOptionForm
to create a modal so that I can edit the selected field. This all works fine.
However, I would like the edit button to only show for certain users (which I'll manage with spatie) - but I'm not sure how to make the button show / hide?
Any ideas?
Thanks3 replies
Option to set default table pagination
Hi,
I'm creating some tables that have plenty data in them. I have pagination enabled with the default options of
[5, 10, 25, 50, 'all']
- I'd like to keep those options, but default the view to 25 rather than 10.
Looking at CanPaginateRecords
I can see the below method, but it seems that we either show 10 rows if it's in the options array, otherwise we just use the first item. I could override the default options and change 10 to 9 or 11, but that doesn't feel right.
Is there a way that I can get round this? Or request it as a feature in a future release?
Cheers
Adam8 replies
Query string in pagination
Hi,
From an edit resource I have a button that links to another list (Audits) resource with 2 parameters like so:
In my audit list resource I then filter all the audits (this is a polymorphic table and stores the model class name and the model id - note that this is using Laravel Auditing - https://laravel-auditing.com/) based on the 2 GET parameters that are passed like so:
Which all works fine on the first load. However, when I change the pagination my request object is reset to null and therefore the above query no longer works.
With Laravel you can do
::paginate()->withQueryString()
but I can't find anything similar with Filament.
Any ideas to ensure that the request object sticks around, or a better solution to this problem that requires no sending of things in the request?
Thanks 🙂8 replies
Unable to add form actions to modal
Hi,
I've got a resource with a simple form for creating / editing. I've got a table that displays all the items on the index. Each row in the table has an edit button that opens the edit page in a modal slideover. At the bottom there is a "Save changes" and "Cancel" button.
I'd like to add an additional button to the bottom, but I'm unable to get it to show.
I added the below to my EditItem.php in the Resource Pages directory and the button didn't show.
I also tried
getModalActions
which made no difference.
If I change the page to be a separate page rather than a modal, the button does appear - but that's not what I want.
I'm at a loss, so any ideas welcome.
Thanks5 replies