Comments (9)
@geneeblack now this should work as you described, you can pass the whole settings object with the changes you need and it will be merged on top of the default settings object.
from ng2-smart-table.
@geneeblack yeah, this is a regression issue from this commit 2ebac0f, will have a look soon.
from ng2-smart-table.
guys, could you try latest changes from master and let me know if everything works as expected? Thanks.
from ng2-smart-table.
The way I was using settings was to send a partial description of new settings, i.e.
settings = {
actions: {
edit:false,
delete: false,
update: false
columns: {...}
}
I can see in #15 that they may have been attempting to set the settings.columns directly on the settings property rather than the assigning the whole settings property. I can see where this wouldn't work because it is not triggering the settings change. Maybe some type of general accessor 'set(propertykey) that would then trigger the property change might be middle ground where individual properties in settings could be changed while still triggering the change. Otherwise you could strong type the settings object and have onchange for each element. Although I am happy to send the whole settings object with only those differences that I wish to change from the default as long as those settings are overlaid on top of the defaults i.e. deepcopy(defaults, mysettings).
from ng2-smart-table.
If I am understanding this right, you are only talking about when you pass the settings object into the component in the view template. What if I wanted to make a change to the table with a settings property after the view is rendered? For example, if I have a button bound to a function in my component that I want to hide the sub header, would I do it like this:
toggleSubHeader() {
console.log('you toggled the sub header');
this.settings.hideSubHeader = !this.settings.hideSubHeader;
}
or do I need to then pass the settings into the smart table component again somehow?
from ng2-smart-table.
@jkon Hi, have the same question, this way don't seems to work for me , have you find a solution ?
from ng2-smart-table.
unfortunately, you have to change this.settings to trigger onChanges event (it's a global angular2 binding issue)
so the right way is :
toggleSubHeader() {
console.log('you toggled the sub header');
this.settings = {
hideSubHeader:!this.settings.hideSubHeader
};
}
from ng2-smart-table.
I had a lot of other customizations that I wanted to do with this package so I made a copy of the repo locally and exposed the initGrid() function. Probably not smartest way, but it allows me to make all the changes I want.
from ng2-smart-table.
Not a fan of this approach as it involves jQuery, but use jQuery to find the smart filters and wire up a button to trigger the toggle.
constructor(@Inject(JQUERY_TOKEN) private $: any) {}
public toggleFilter() {
const filterRow = this.$('.ng2-smart-filters');
this.hideSubHeader = !this.hideSubHeader;
this.hideSubHeader ? filterRow.hide() : filterRow.show();
}
from ng2-smart-table.
Related Issues (20)
- ServerDataSource: API error Handling
- Any way to send some data to custom filter component?
- How to Make table scrollable vertically (left to right) if we are using n2-smart-table?
- How to show or hide a tag in the column tags in ng2-smart-table
- Issue while using in Angular 14 HOT 2
- Allow providing static row classes
- Access to Documentation for Old versions
- valuePrepareFunction not parsing JSON on EDIT
- How can I get the index of current page
- Column list elements are not visible HOT 1
- Table not work when I refresh page HOT 2
- Is it possible create a custom list filter of a column in my smart table? HOT 1
- How to add CSS class to ng2-smart-table <td> ?
- How to get the row element? HOT 1
- SetFilter() and SetPaging() are not Working Properly
- I am using ng2 smart table library ad when i clicked on edit than one column is editable rest column is not editable. before click on the edit button data is displayed in the all columns but after click on that some column fields are empty. How can I resolve this issue in ng2 smart table. I am sharing my angular code.
- Support for Angular 15.x
- Is there a way to combine AND and OR operators in the setFilter function?
- Support for Angular 17.x
- Support for Angular 17.x HOT 2
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 ng2-smart-table.