1. I have created a custom button called "Duplicate" which I have mounted to the my Grid's Toolbar.
Since
I am trying to place a Syncfusion Materials Icon beside my custom
Toolbar button, I am unable to follow the Icon Library instructions from
this link: https://ej2.syncfusion.com/react/documentation/appearance/icons/?_gl=1*1ozsky4*_ga*MTg1NDczMzUwNC4xNjQzMzkwMDQy*_ga_WC4JKKPHH0*MTY0NzAyMzM4NC42My4xLjE2NDcwMjM3NDguMA..&_ga=2.126954445.1321204948.1646765094-1854733504.1643390042#available-icons
Please tell me the workaround.
2. I followed the last set of instructions called "Both built-in and custom items in toolbar" in this link: https://ej2.syncfusion.com/react/documentation/grid/tool-bar/tool-bar-items/
My
issue is that when I trigger the clickHandler function which basically
sends at least one API POST call, I have to manually refresh the screen.
Please advise on how the manual refresh can be avoided as I am not sure
how to possibly adjust the "actionBegin" and "actionComplete"
functions that I have.
3. The first column in my Grid is the checkbox column,
please tell me how to center the title's checkbox so that it is aligned
with the rest.
4. Single-deletion works fine but the only issue
with multi-deletion is that I always get an alert message saying: "No
records selected for delete operation" after the operation. Please tell
me how to fix it.
5. I want to style my grid but it looks like
that is not possible when just experimenting with the Theme Studio (the
Grid does change color(s) at all): https://ej2.syncfusion.com/themestudio/?theme=bootstrap5
Please advise if styling the grid is even possible.
|
this.toolbarOptions = [
{
text: 'Duplicate' ,
prefixIcon: 'e-copy'
},
];
|
|
clickHandler(args) {
. . .
duplicatSelectedrecords.forEach((item, i) => {
. . .
ajax.onSuccess = (args) => {
if (i === duplicatSelectedrecords.length - 1) {
this.setGridData();
}
};
});
}
}
componentDidMount() {
this.setGridData();
}
setGridData() {
const ajax = new Ajax(
'customDic3',
'GET'
);
ajax.send();
ajax.onSuccess = (data) => {
if (this.gridInstance) {
this.gridInstance.dataSource = JSON.parse(data);
}
};
}
|
|
<ColumnDirective type="checkbox" textAlign="Center" width="50" />
|
|
actionBegin(e) {
// Initially flag needs to be false in order to enter this condition
if (!this.flag) {
. . .
if (e.requestType == 'delete') {
. . .
// Here you can send the deleted data to your server using ajax call
keyNamesList?.forEach((keyName, i) => {
var ajax = new Ajax({
url: `customDic2?keyName=${keyName}`,
type: 'DELETE',
});
ajax.onSuccess = (args) => {
if (i === keyNamesList.length - 1) {
// Flag is enabled to skip this execution when grid deletes record
this.flag = true;
// The deleted data will be removed in the Grid
this.gridInstance?.deleteRecord();
}
};
. . .
});
}
}
}
|
Thank you for your response.
Also, I noticed that the DataGrid will show the message "No results to display" when loading the data. Is there a simple loading animation I can put because even for a brief moment, I do not want the user of my application to be confused and accidentally believe there is no data to show.
I tried going through the documentation to see if there is a built in loading animation to no avail.
Please let me know what can be done.
Regards,
Roha
| setGridData() { this.gridInstance.element.querySelector('.e-spinner-pane').classList.add('showspin'); const ajax = new Ajax( 'customDic3', 'GET' ); ajax.send(); ajax.onSuccess = (data) => { if (this.gridInstance) { this.gridInstance.dataSource = JSON.parse(data); this.gridInstance.element.querySelector('.e-spinner-pane').classList.remove('showspin'); } }; } |
| .showspin { display: initial !important; } |
Thank you and kindly remove the url for privacy concerns.