+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
);
}
// rendering above component in the React DOM
-const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render(
);
+const root = ReactDOM.createRoot(document.getElementById("root"));
+root.render(
);
diff --git a/samples/grids/grid-lite/sort-config-grid/src/index.tsx b/samples/grids/grid-lite/sort-config-grid/src/index.tsx
index 6dcaff9b7c..4cf9af5c69 100644
--- a/samples/grids/grid-lite/sort-config-grid/src/index.tsx
+++ b/samples/grids/grid-lite/sort-config-grid/src/index.tsx
@@ -1,78 +1,94 @@
-import React, { useRef, useState } from 'react';
-import ReactDOM from 'react-dom/client';
-import { IgrSwitch } from 'igniteui-react';
-import { GridLiteDataService, ProductInfo } from './GridLiteDataService';
+import React, { useRef, useState } from "react";
+import ReactDOM from "react-dom/client";
+import { IgrRating, IgrSwitch } from "igniteui-react";
+import { GridLiteDataService, ProductInfo } from "./GridLiteDataService";
-// Import the web component
-import { IgcGridLite } from 'igniteui-grid-lite';
-import {
- defineComponents,
- IgcRatingComponent
-} from 'igniteui-webcomponents';
+import {
+ IgrGridLite,
+ IgrGridLiteColumn,
+ type IgrCellContext,
+} from "igniteui-react/grid-lite";
import "igniteui-webcomponents/themes/light/bootstrap.css";
import "./index.css";
-// Register components
-IgcGridLite.register();
-defineComponents(IgcRatingComponent);
-
// Define cellTemplate function outside component
-const ratingCellTemplate = (params: any) => {
- const rating = document.createElement('igc-rating');
- rating.setAttribute('readonly', '');
- rating.setAttribute('step', '0.01');
- rating.setAttribute('value', params.value.toString());
- return rating;
-};
+const ratingCellTemplate = (ctx: IgrCellContext) => (
+
+);
export default function Sample() {
const gridRef = useRef
(null);
- const [switchChecked, setSwitchChecked] = useState(true);
+ const [data, setData] = useState([]);
const [sortingOptions, setSortingOptions] = useState({
- mode: 'multiple'
+ mode: "multiple",
});
React.useEffect(() => {
- if (gridRef.current) {
- const dataService = new GridLiteDataService();
- const data: ProductInfo[] = dataService.generateProducts(100);
- gridRef.current.data = data;
- gridRef.current.sortingOptions = sortingOptions;
- }
- }, [sortingOptions]);
+ const dataService = new GridLiteDataService();
+ const items: ProductInfo[] = dataService.generateProducts(100);
+ setData(items);
+ }, []);
- const updateConfig = React.useCallback((prop: string, checked: boolean) => {
- setSwitchChecked(checked);
-
- if (prop === 'multiple' && gridRef.current) {
- const mode = checked ? 'multiple' : 'single';
- setSortingOptions({ mode });
-
- gridRef.current.sortingConfiguration = { mode };
- gridRef.current.clearSort();
- }
+ const updateConfig = React.useCallback((checked: boolean) => {
+ const mode = checked ? "multiple" : "single";
+ setSortingOptions((prev: any) => ({ ...prev, mode }));
+ gridRef.current?.clearSort();
}, []);
-
+
return (
-
- updateConfig('multiple', e.target.checked)}>
- Multiple Sort
+
+ updateConfig(e.target.checked)}
+ >
+ Enable multi-sort
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
);
}
// rendering above component in the React DOM
-const root = ReactDOM.createRoot(document.getElementById('root'));
-root.render();
+const root = ReactDOM.createRoot(document.getElementById("root"));
+root.render();
diff --git a/samples/grids/grid-lite/styling-custom-theme/src/index.scss b/samples/grids/grid-lite/styling-custom-theme/src/index.scss
index 05f2e065e4..43ec409884 100644
--- a/samples/grids/grid-lite/styling-custom-theme/src/index.scss
+++ b/samples/grids/grid-lite/styling-custom-theme/src/index.scss
@@ -1,7 +1,14 @@
@use 'igniteui-theming' as *;
@import 'igniteui-theming/sass/typography/presets';
-$custom-palette: palette(
+$custom-light-palette: palette(
+ $primary: #ddd020,
+ $secondary: #d5896f,
+ $surface: #f8f7ff,
+ $gray: #04395e,
+);
+
+$custom-dark-palette: palette(
$primary: #ddd020,
$secondary: #d5896f,
$surface: #031d44,
@@ -13,7 +20,16 @@ $custom-palette: palette(
height: 100%;
}
-.custom-styled {
- @include palette($custom-palette);
+.theme-switcher {
+ margin-bottom: 1rem;
+}
+
+.custom-light {
+ @include palette($custom-light-palette);
+ @include typography('"Merriweather Sans", sans-serif', $bootstrap-type-scale);
+}
+
+.custom-dark {
+ @include palette($custom-dark-palette);
@include typography('"Merriweather Sans", sans-serif', $bootstrap-type-scale);
}
diff --git a/samples/grids/grid-lite/styling-custom-theme/src/index.tsx b/samples/grids/grid-lite/styling-custom-theme/src/index.tsx
index 8ce1fde75f..bee4c5dad9 100644
--- a/samples/grids/grid-lite/styling-custom-theme/src/index.tsx
+++ b/samples/grids/grid-lite/styling-custom-theme/src/index.tsx
@@ -2,49 +2,52 @@ import React from 'react';
import ReactDOM from 'react-dom/client';
import { GridLiteDataService, ProductInfo } from './GridLiteDataService';
-// Import the web component
-import { IgcGridLite } from 'igniteui-grid-lite';
-import {
- defineComponents,
- IgcRatingComponent
-} from 'igniteui-webcomponents';
+import { IgrSwitch } from 'igniteui-react';
+import {
+ IgrGridLite,
+ IgrGridLiteColumn,
+} from 'igniteui-react/grid-lite';
import "igniteui-webcomponents/themes/light/bootstrap.css";
import "./index.scss";
-// Register components
-IgcGridLite.register();
-defineComponents(IgcRatingComponent);
-
-// Define cellTemplate function outside component
-const ratingCellTemplate = (params: any) => {
- const rating = document.createElement('igc-rating');
- rating.setAttribute('readonly', '');
- rating.setAttribute('value', params.value.toString());
- return rating;
-};
-
export default function Sample() {
- const gridRef = React.useRef(null);
+ const [data, setData] = React.useState([]);
+ const [theme, setTheme] = React.useState<'dark' | 'light'>('dark');
React.useEffect(() => {
- if (gridRef.current) {
- const dataService = new GridLiteDataService();
- const data: ProductInfo[] = dataService.generateProducts(50);
- gridRef.current.data = data;
- }
+ const dataService = new GridLiteDataService();
+ const items: ProductInfo[] = dataService.generateProducts(50);
+ setData(items);
+ }, []);
+
+ const switchTheme = React.useCallback(() => {
+ setTheme((prev) => (prev === 'dark' ? 'light' : 'dark'));
}, []);
return (
-
-
-
-
-
-
-
+
+
+ {`Switch to ${theme === 'dark' ? 'light' : 'dark'} theme`}
+
+
+
+
+
+
+
+
+
);