angularng2-smart-table

ng2-smart-table use the space where "add" button is for "select columns" button


The place where the "Add" button is located seems wrong, on the other hand it is a good place for "Columns selection" button that will open a dialog that will allow the users to select which columns to see and which to hide

This is the relevant code changes that i have made to the settings configuration:

actions: { 
          columnTitle: 'Actions',
          class: 'actions-area',
          add: true,              
        },    
        add: {
          addButtonContent: '<i class="nb-gear" title="select columns"></i>',
          createButtonContent: '<i class="nb-checkmark"></i>',
          cancelButtonContent: '<i class="nb-close"></i>',
        },

So this code above only replaces the icon from the "+" icon to the "gear" icon

See image

enter image description here

Now i want this button to call my on function and not to the default function that adds a row to the table, since what i really want to do is not related to the "add" functionality i just need the asset space for it

Can this be done?


Solution

  • Check here https://akveo.github.io/ng2-smart-table/#/documentation

    You need to change your mode configuration to External

    Then use this event to access that button

    Then you add the event to the html

    And finally you add your function to your ts.

    youFunction(){
      //your code here
    }