Hi Supportteam,
is there a way to use a custom column header in Blazor DxDataGrid?
Thanks,
Niki
Hi Supportteam,
is there a way to use a custom column header in Blazor DxDataGrid?
Thanks,
Niki
Hello Niki,
Thank you for your clarification. At this moment, the only workaround is to change a column's caption on the client side via JavaScript interop.
You need to set a CSS Class marker by setting the CssClass property, e.g. with the my-grid
value. Inject IJSRuntime on a page:
Razor@inject IJSRuntime JSRuntime
In the OnAfterRenderAsync method, call a JS function that would change a column's caption:
C#protected override async Task OnAfterRenderAsync(bool firstRender) {
await JSRuntime.InvokeAsync<string>("changeCaption", "TemperatureF");
}
You can implement the changeCaption function in the following manner:
JavaScriptfunction changeCaption(caption) {
var myGrid = document.querySelector(".my-grid");
var headers = myGrid.querySelectorAll(".dxbs-fixed-header-content");
for (var i = 0; i < headers.length; i++) {
var header = headers[i];
if (header.innerText == caption) {
var link = header.querySelector("a");
link.innerHTML = "<i class='fa fa-car'></i>";
break;
}
}
}
Please note that this is only a temporary workaround so make sure that you test it thoroughly after update to future versions before a build-in solution is not provided.
I've attached a sample project so you can test how it works. Let me know if you have additional questions.
Hi,
Currently this feature is not supported yet. Please use the workaround suggested above.
Greeting from 2021.
I suppose this feature is not implemented.
So I want to suggest add some property with type Object to every column's header (like ExtendedProperties in DataTable).
And then put this property to HtmlColumnHeaderCell event parameter.
It's very important for dynamically created column's appearance.
Thanks.
Hello,
Let's discuss this in a separate ticket which I created on your behalf (T976315: DataGrid for Blazor - Extended properties for columns).
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Hello Niki,
Currently, we do not support this. Would you please clarify why you need this header template and what content you would like to have there? What about the sort indicator icon? Do you plan to implement your own icon when a header is clicked? Please describe your scenario so we can consider it in the future and/or provide you with a workaround.
Hi,
I would like to have an icon instead of the caption or adjust the font size of the caption!
Regards,
Niki