-
-
Notifications
You must be signed in to change notification settings - Fork 858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Pass Model Data Into Laravel Blade #1348
Comments
why not using addColumn method ?
or directly exploding without returning a view if you want :
be aware that you will need to disable searcheable and orderable on this column or do it yourself with filterColumn and orderColumn. And you will need rawColumns(['datatoexplode']) if you want to use html. But i think you have a modelisation problem here, if you have to explode data from the base, it's better to have an enum. |
Thanks a lot for the quick responses much appreciated. I see ->addColumn would be a great option if I were implementing this on the parent row. Remember I'm implementing the explode on a variable that will go to the details row (Unless if that can still work for the child row as well) as exemplified in the code below:
I am exploring rawColumns and enum options as well. Links to any relevant resources would be immensely appreciated. Thanks again. I must mention that this is my first major attempt at Laravel and Datatables. |
I think this demo is what you need for ref? |
Thanks again Yajra for a lighting fast response. However instead of using the master and details tables I'm using the Row Details demo. The one this url Link So it's essentially working with data from the same table and row for example: fetching user details and showing name and surname on the parent row and then showing Email and Telephone and datatoexplode variables of the same user on the child row. And in my case I want to explode the datatoexplode variables and cast raw html for formatting. Thanks again. |
i see, you do not want to explode the data in a more readable format in one column, but you want to explode in multiple columns ? |
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been inactive for 7 days since being marked as stale. |
Summary of problem or feature request
Hi there. Firstly, a million thanks for the great laravel datatables framework Yajra
I have been digging around for a solution to manipulate $posts model data in the row.details.blade.php view
I'm still fresh on Laravel particularly datatables and I figured that yajrabox is the best datatables approach for a database driven app.
The objective is pretty straight forward but I'm struggling to get it right in the yajrabox datatables context:
Here is what I need to do.
I have a column in model (table) storing data this way NO|YES|NO|YES
So on the row.details.blade.php I need to explode that data and for example display icons based on whether the exploded array item is a YES or NO.
Take note that I need to apply this on the details-template and not on the main table or row.
I have tried to find out how to explode {{variable}} with no success.
I have also tried parsing Posts model data to view using with, withModel and compact with no success.
Here is what I have currently:
The Eloquent Controller
The Details template in blade
My aim is to explode the {{datatoexplode}} variable so I can access the |YES|NO|YES|YES| items and iterate them and format before rendering the html output. If I can get that in PHP that would be great.
Any help will be much appreciated.
System details
The text was updated successfully, but these errors were encountered: