question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Action column toggle behavior changed

See original GitHub issue

In version 1.1.0 and prior, I was able to toggle the entire action column on and off using this code:

tableSettings = {
    actions: {
        add: false,
        edit: false,
        delete: false
    }
}

deleteToggle () {
    const changeDelete = Object.assign({}, this.tableSettings)
    changeDelete.actions.delete = !changeDelete.actions.delete
    this.tableSettings = Object.assign({}, changeDelete)
}

As of version 1.2.0, this behavior has changed - if the settings object has delete: true when the page loads, toggling it will remove the delete links but leave behind an empty column, while if it starts with delete: false, toggling it does nothing visible at all.

This seems to be related to the performance improvements in 69e883c - I was able to get it partially working by rolling back some of the changes in thead-titles-row.component.ts - but I’m not sure what the best way to handle it would be.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
jkoncommented, Aug 4, 2017

So, I poked around a bit more and found that in the new version, you can import the Ng2SmartTableComponent and call the initGrid() function on it. This will redraw the grid entirely with all of your settings changes. I had previously copied the repo and exposed it this myself, but when I saw the newest version of ng2-smart-table, I found that most of my customization issues had been addressed, so I just started using the new version. This was the last issue I was trying to recreate, so I’m really glad that initGrid() is exposed now. Here is an example: smart-table.component.ts … import { Ng2SmartTableComponent } from ‘ng2-smart-table/ng2-smart-table.component’; … toggleEditMode( table: Ng2SmartTableComponent ) { if ( this.editing ) { this.settings.actions = { add: false, edit: false, ‘delete’: false, }; this.settings.columns = this.columns; } else { this.settings.actions = { add: true, edit: true, ‘delete’: false, }; this.settings.columns = this.editingColumns; } table.initGrid(); this.editing = !this.editing; } …

smart-table.component.html … <ng2-smart-table #table [settings]=“settings” [source]=“source” (deleteConfirm)=“onDeleteConfirm($event)”> </ng2-smart-table> …

hope this helps folks out some.

0reactions
johnm0ntycommented, Aug 7, 2017

@jkon Thanks for finding that! I think at this point we’re committed to staying with 1.1.0 for this release, but hopefully that’ll be useful in the future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toggling Stretch Column Widths in an Interactive Grid
To change the behavior of interactive grid column widths: Click Actions and select Format. If there is a checkmark next to Stretch Column...
Read more >
How to toggle ExtJs grid action column icon and tooltip?
I need to toggle Action column icons and tooltip. I have 2 images for Play and Pause (play-icon.png and pause-icon.png) I want to...
Read more >
Toggles - Selection and input - Human Interface Guidelines
Use a toggle to help people choose between two opposing values that affect the state of content or a view. A toggle always...
Read more >
Actions: The Essentials - AppSheet Help - Google Support
All actions have configurable behavior options that control which rows to display the action and whether or not it requires confirmation before being...
Read more >
Demo: Using Actions to Change Column Values - YouTube
We make an app about apples with Spec. In the demo, we show how to use conditional formatting to customize the app. We...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found