dcasia / conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.
MIT License
115 stars 37 forks source link

field not shown in index view #67

Closed ZoreAnkit closed 2 years ago

ZoreAnkit commented 2 years ago

I have following code

ConditionalContainer::make([
                        Text::make(__('Order No'), 'order_number')->nullable()->showOnIndex(),
                    ])
                        ->if('category = small_project OR category = big_project'),

I do not see this field in index view check below image for ref

Selection_103

milewski commented 2 years ago

That is right, fields are removed from the index view on purpose. as this could break your table.. imagine the first row has 5 columns.. but the second has 10... it would completely break the layout

ZoreAnkit commented 2 years ago

What do i do if i want to show field in index view?

milewski commented 2 years ago

You can define the method fieldsForIndex() { } and return all the fields you need visible on the index..

ZoreAnkit commented 2 years ago

Thank you so much for the package. Above solution works for showing fields in index view even if they are declared in conditional container.