Comments (4)
Hi @hossameldeen,
I think you have found an issue. The thing is that originalData
could be undefined, but currentData
shouldn't: the first one is only populated when editing an element, and the last one is the one that holds the row data, so it should not be undefined. I'm not with my PC near now, but I can fix it and push soon.
from angular4-material-table.
Hi @hossameldeen,
I've published a new version with this fix. :)
If you have any question please let me know.
from angular4-material-table.
@irossimoline , I was writing this comment when you pushed the fix :-) Thanks for the prompt response and for the awesome package!
I've checked it, will upgrade. Nope, no more questions
By the way, I'm a fan of strictNullChecks
. So, I've tried to enable it on your project and resolve the errors. One error that particularly caught my eye is this:
cancelOrDelete(): void {
if (this.id == -1 || !this.editing)
this.delete();
else {
this.currentData = this.originalData; // I've made currentData required while originalData optional, so an error came up here for assigning optional to required
this.editing = false;
this.validator.disable();
}
}
Of course, the if-condition above !this.editing
makes sure that we're in editing mode in the other branch & thus have originalData
. But how to make sure that editing == true -implies-> originalData !== undefined
across the whole code?
For the purposes of technical curiosity, I've made a solution & reached it to passing compilation (didn't even test). I probably don't recommend merging it into the package since it'll break backward compatibility and may need a bit refactoring. But anyway, I'm opening a PR with it in case you want to check it out :-)
Thanks again :-)
from angular4-material-table.
Cool @hossameldeen!
I'm gonna close this issue, and lets talk about the code improvement proposed directly on the PR.
Thank you in advance for contributing with this project! 😃
from angular4-material-table.
Related Issues (20)
- Which function to call for sending a put request to my server? HOT 4
- Warning message Ngmodel is getting deprecated HOT 5
- How to get the current data in TableDataSource? HOT 1
- createNew function HOT 4
- Not an Issue - HTTP interceptor Conflict with keycloak-angular HOT 1
- How to create a method in component of row.confirmEditCreate() HOT 2
- Issue with node_modules with in angular4-material-table package HOT 2
- TypeError: undefined is not an object (evaluating 'this.dataKeys.reduce') HOT 1
- Release for Angular 7 HOT 1
- Conflict with rendere 3 in node_modules HOT 3
- extending MatTableDataSource instead DataSource HOT 1
- Upgrade to angular 7 to angular 8 HOT 3
- Date picker edit field doesn't fit in the cell
- ERROR TypeError: Class constructor DataSource cannot be invoked without 'new' HOT 5
- error TS2416: Property 'connect' in type 'TableDataSource<T>' is not assignable to the same property in base type 'DataSource<TableElement<T>>'. HOT 18
- Build errors after updating to 0.8.0 HOT 1
- Cannot overwrite row.currentData HOT 1
- Upgrade to Angular 9 HOT 1
- p-autocomplete shows focus on second tab click
- Nested Properties for sortingDataAccessor
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 angular4-material-table.