59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
/**
|
|
* Custom renderer for HOT cell
|
|
* Used to show error icon
|
|
*/
|
|
export const errorRenderer = (
|
|
instance: any,
|
|
td: any,
|
|
row: number,
|
|
col: number,
|
|
prop: string,
|
|
value: any,
|
|
cellProperties: any
|
|
) => {
|
|
td.innerHTML = `${
|
|
value ? value.toString() : ''
|
|
} <clr-icon shape="exclamation-circle" status="warning"></clr-icon>`
|
|
|
|
return td
|
|
}
|
|
|
|
/**
|
|
* Custom renderer for HOT cell
|
|
* Used to revert cell back to original state (no spinner, no error)
|
|
*/
|
|
export const noSpinnerRenderer = (
|
|
instance: any,
|
|
td: any,
|
|
row: number,
|
|
col: number,
|
|
prop: string,
|
|
value: any,
|
|
cellProperties: any
|
|
) => {
|
|
td.innerHTML = value ? value : ''
|
|
|
|
return td
|
|
}
|
|
|
|
/**
|
|
* Custom renderer for HOT cell
|
|
* Used to show loading spinner in the cell
|
|
* (Spinner shown whilst waiting for SAS to respond)
|
|
*/
|
|
export const spinnerRenderer = (
|
|
instance: any,
|
|
td: any,
|
|
row: number,
|
|
col: number,
|
|
prop: string,
|
|
value: any,
|
|
cellProperties: any
|
|
) => {
|
|
td.innerHTML = `${
|
|
value ? value.toString() : ''
|
|
} <span class="spinner spinner-sm vertical-align-middle"></span>`
|
|
|
|
return td
|
|
}
|