-2

I have an angular application which has a lot of components using DxDataGrid, all of them have the same default options. Is it possible to set the default options somewhere at any settings file or something similar?

Esteban Chornet
  • 928
  • 3
  • 14
  • 38
  • Can you provide us with the code you have already written? – hkoosha Nov 12 '19 at 13:27
  • Answer is down. I can accept the answer in 2 days.. – Esteban Chornet Nov 12 '19 at 16:13
  • cool! glad to hear that you solved it. but anyway to keep stackoverflow.com useful, we try to post self contained question & answers, not to make people follow links to get the answer / question, read everything right here: for questions include [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and for answers, quote and copy paste here. – hkoosha Nov 12 '19 at 18:42
  • Sorry! Updated answer. Thanks – Esteban Chornet Nov 13 '19 at 08:27

1 Answers1

1

Use the dxDataGrid.defaultOptions method to set default configuration options for all DataGrid widgets. This method is static and you can call it in a constructor of the main component.

export class AppModule {  
  constructor() {  
    DataGrid.defaultOptions({  
      options: {  
        showRowLines: true,  
        showColumnLines: false,  
        rowAlternationEnabled: false,  
        focusedRowEnabled: true,  
        allowColumnResizing: true,  
        noDataText: "",  
        scrolling: {  
          mode: "virtual"  
        },  
        sorting: {  
          mode: "single"  
        },  
        loadPanel: {  
          enabled: false  
        }
      }  
    });  
  }  
}

https://www.devexpress.com/Support/Center/Question/Details/T738119/datagrid-how-to-define-default-configuration-options-for-angular-components

Answered in this question from DevExtreme support

Esteban Chornet
  • 928
  • 3
  • 14
  • 38