I am creating SPFx app. Here is the code :
React Version : 16.9.0
Kendo versions :
"@progress/kendo-data-query": "^1.5.6",
"@progress/kendo-licensing": "^1.2.2",
"@progress/kendo-react-animation": "^5.1.0",
"@progress/kendo-react-common": "^5.1.0",
"@progress/kendo-react-data-tools": "^5.2.0",
"@progress/kendo-react-excel-export": "^5.1.0",
"@progress/kendo-react-grid": "^5.1.0",
"@progress/kendo-react-intl": "^5.1.0",
"@progress/kendo-react-pdf": "^5.1.0",
"@progress/kendo-theme-default": "^5.3.0",
import * as React from "react";
import { Grid, GridColumn, GridExpandChangeEvent, GridDetailRow, GridToolbar, GridColumnProps } from '@progress/kendo-react-grid';
import { process, State, DataResult } from '@progress/kendo-data-query';
import'@progress/kendo-theme-default/dist/all.css';
export const BizpSettingGrid: React.FunctionComponent<IBizpSettingGridProps> = (
props: React.PropsWithChildren<IBizpSettingGridProps>
) => {
const [items, setItems] = React.useState([]);
const [isLoading, setIsLoading] = React.useState(false);
const [showAddButton, setShowAddButton] = React.useState(true);
const getKendoColumns=()=>{
// let cols=props.viewFields.map((itm, i)=> <GridColumn key={i} sortable={true} groupable={true} filterable={true} /> )
//let cols=props.viewFields.map((itm, i)=> <GridColumn field ={itm.name} title={itm.displayName} key={i} sortable={true} groupable={true} filterable={true} /> )
// return cols;
let cols: GridColumnProps[]=[
{ field: 'ProductID', title: 'ID', filter: 'numeric' },
{
field: 'ProductName', title: 'Product Name',
reorderable: false
},
{
field: 'QuantityPerUnit', title: 'Quantity Per Unit',
groupable: false
},
{
field: 'UnitsInStock', title: 'Units In Stock', filter: 'numeric',
reorderable: false,
groupable: false
},
{ field: 'Category.CategoryName', title: 'Category Name' }
];
}
return (
<Panel
styles={{
commands: {
backgroundColor: "[theme:themePrimary, default:#0078d7]",
marginTop: 0,
},
scrollableContent: { overflow: "hidden" } /* Add: Jul-01-2021 */,
}}
className={`${styles["PanelWrapper"]}`} /* Add: Jul-01-2021 */
id={props.panelId}
isOpen={props.showPanel}
onDismiss={props.onDismissPanel}
type={PanelType.large}
closeButtonAriaLabel="Close"
headerText={props.panelHeading}
onOuterClick={() => undefined}
onOpen={() => getItems()}
// isBlocking={false}
>
{/* {props.selectedItem.itemId ==0 && ( */}
{isLoading && <BizpSpinner message="Please wait loading records..."></BizpSpinner>}
{!isLoading && (
<React.Fragment>
<Toolbar actionGroups={toolBarActionGroups} find={false} />
<Grid
style={{
height: "400px",
}}
data={items}
>
{getKendoColumns()}
</Grid>
</React.Fragment>
)}
</Panel>
);
};