jQuery UI Widgets › Forums › Angular › How to change the Empty Grid Message "No data to display"
Tagged: angular 5, Empty Grid Message, jqxGrid ;
This topic contains 7 replies, has 2 voices, and was last updated by Martin 6 years, 4 months ago.
-
Author
-
Hi Team,
I want to change the default message for empty grid message “No data to display” to something else.
but I’m not able to get anything regarding this.
Please can you help to resolve this issue?Thanks
Hello shakti_singh,
Your can change the empty data string by passing a localization object to the ‘localizestrings’ function.
var localizationobject = {}; localizationobject.emptydatastring = "Custom no data message"; $("#grid").jqxGrid('localizestrings', localizationobject);
You can also read more about the Grid Localization here
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Hi Team,
I have tried to implement the given code in angular but it is giving error. and it is not reflecting in the jqxgrid.
How I have tried just have a look into that. If any correction, please provide in angular codengOnInit() { let localizationObj = {} localizationObj.emptydatastring: "Custom no data message.", this.myGrid.localizestrings(localizationObj.emptydatastring); }
Please help regarding this issue.
Thanks
Hello shakti_singh,
You should put this code in the ‘ngAfterViewInit’ life hook, as the grid is not yet created in ‘ngOnInit’, that is why it is not reflecting.
Also, you should pass the whole object to myGrid.localizestrings, not only the string.Here is how it is working:
ngAfterViewInit() { let localizationObj = {}; localizationObj['emptydatastring'] = "Custom no data message.", this.myGrid.localizestrings(localizationObj); }
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Hi Team,
I have tried the provided codengAfterViewInit() { let localizationObj = {}; localizationObj['emptydatastring'] = "Custom no data message.", this.myGrid.localizestrings(localizationObj); }
but still it is not changing the empty grid message.
And in console it is giving the error ” Cannot read property ‘localizestrings’ of undefined”.Please can you look into that to resolve the issue.
Thanks.
Hello shakti_singh,
Maybe you have not added
@ViewChild('myGrid') myGrid;
and#myGrid
selector in the grid html element, so then you can use myGrid.
Here is a DemoBest Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Hi Martin,
I have already used the myGrid selector in @viewchild but still it is not working for me. I’m using jqwidget 5.6.0.
Is there any issue with this version?I saw your demo also.
Is there any other way to do this?
Thanks
Hello shakti_singh,
Can you, please, send me your code?
Thank you!Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.