а

Grid - Column aligment


#1

Hi, is there a way to align the content of columns (possibly excluding tricky ways) like setColAlign?
I’ve not found nothing about in the documents, but i’ve seen numeric content align to the right (only if the first char of the first row of dataset in column contain is a number) and Strings to the left… there is a way to force?


#2

Unfortunately currently there is no analog of the setColAlign() method for thew grid 6.
You may change the align for the data in the column using the “mark” property of the column.
For the align in the header you may use the css property.
Here is an example:

// in the grid config:
columns: [
{ width: 200, id: "country", header: [{ text: "Country", css: "newAlign" }], mark: () => "newAlign" },

// and in the css:
.newAlign {
text-align: center;
}

We’re planning to extend API fro the “align” property in the future updates, so you will definitely will be able to find the analog of the setColAlign method for the dhtmlxGrid 6.