Comments (7)
What version of PHP are you running? Also, is this Laravel 7?
I noticed similar problems with Laravel 7 and a PHP version below 7.3. After I set my PHP version to 7.3 these issues went away.
from laravel-livewire-tables.
I'm using laravel 6.18 and php 7.2
from laravel-livewire-tables.
@kdion4891 I have the same problem.
public $projectId;
public function mount(Project $project)
{
$this->setTableProperties();
$this->projectId = $project->id;
}
I'm running Laravel 7, php 7.3 and livewire 1.x
from laravel-livewire-tables.
Same issue for me. It's because in the "original" mount method, there is no argument being passed to it.
How can we solve this?
from laravel-livewire-tables.
So what I did to "solve" this, was to extend the TableComponent
that all new DataTable classes have. I have created my own "CustomTableComponent" (call it what you want):
This custom component then extends the TableComponent, but in here I can successfully override the mount()
method, to accept (in my case) an $id
.
class CustomTableComponent extends TableComponent
{
public function mount($id = null)
{
$this->setTableProperties();
}
}
In my DataTable class, I simply then extend my CustomTableComponent
:
class UserTable extends CustomTableComponent
{
public $user_id;
public function mount($id = null)
{
$this->user_id = $id;
parent::mount($this->user_id);
}
}
from laravel-livewire-tables.
if someone comes up with a decent solution please submit a PR
from laravel-livewire-tables.
Hello i've came on this same issue recently.
I'm not sure, but doesn't seems correct to hijack the mount method as is the single method that allows to hook into the mount process.
What i've done was to override the construct and call $this->setTableProperties(); there.
Its wrorking for me and i would be willing to submit a PR but im not sure if it brokes something anywhere else, but as far as I was able to check this method only set some properties based on the configuration file, so it should be a major problem.
Any thoughts?
from laravel-livewire-tables.
Related Issues (20)
- Export to PDF or CSV buttons HOT 6
- Searchable not working
- Is there any way to add selectbox to change perpage? HOT 1
- How to pass variable? HOT 2
- bulk delete via checkbox deletes all - not just those in view HOT 1
- Suggestion to add tdPresenter()
- Call to undefined method when using relationship with camel case
- Don't works if model primaryKey is not `id` HOT 1
- How can I use search on secondary table in joining statement?
- proposal: excel export
- artisan make broken for namespaced classes
- Example for restricting the results
- Livewire 2 HOT 2
- optional pagination
- Proposal: Add view attributes as second parameter to view() function
- Make row clickable HOT 1
- How to capture selected value from outside component? HOT 1
- multiple sort fields
- Sorting relationships on table HOT 2
- Add export to .pdf as well
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-livewire-tables.