@scheels-softdev/kendoreact-generics 2.4.6 → 2.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GenericDropdown.js +6 -2
- package/Utility.d.ts +3 -0
- package/Utility.js +5 -0
- package/package.json +1 -1
package/GenericDropdown.js
CHANGED
@@ -17,7 +17,7 @@ export function GenericDropdown({ data, selectedId, selectedData, onChange, text
|
|
17
17
|
subsetData: dataList.slice(0, pageSize),
|
18
18
|
});
|
19
19
|
//external function variables
|
20
|
-
|
20
|
+
let filteredData = useRef(dataList.slice());
|
21
21
|
//function creation
|
22
22
|
// function to handle filter changes
|
23
23
|
const onFilterChange = (event) => {
|
@@ -35,12 +35,16 @@ export function GenericDropdown({ data, selectedId, selectedData, onChange, text
|
|
35
35
|
};
|
36
36
|
// function to handle page changes for virtualization
|
37
37
|
const pageChange = (event) => {
|
38
|
+
console.log("page change data: ", event.page, filteredData.current);
|
38
39
|
const skip = event.page.skip;
|
39
40
|
const take = event.page.take;
|
40
|
-
const newSubsetData = filteredData.current.slice(skip, skip + take);
|
41
|
+
const newSubsetData = filteredData.current.length ? filteredData.current.slice(skip, skip + take) : dataList.slice(skip, skip + take);
|
41
42
|
setState(Object.assign(Object.assign({}, state), { subsetData: newSubsetData, skip: skip }));
|
42
43
|
};
|
43
44
|
//change event listeners
|
45
|
+
useEffect(() => {
|
46
|
+
dataList;
|
47
|
+
});
|
44
48
|
useEffect(() => {
|
45
49
|
if (data.length) {
|
46
50
|
setDataList(data.map((x) => {
|
package/Utility.d.ts
CHANGED
package/Utility.js
CHANGED
@@ -4,3 +4,8 @@ export const getTextValue = (dataItem, fields, separator) => {
|
|
4
4
|
fields.forEach((field, index) => (textValue += index > 0 ? (separator ? separator : " ") + dataItem[field] : dataItem[field]));
|
5
5
|
return textValue;
|
6
6
|
};
|
7
|
+
export const getDropdownArray = (data, textFields, separator) => {
|
8
|
+
return data.map((x) => {
|
9
|
+
return Object.assign(Object.assign({}, x), { textValue: getTextValue(x, textFields.map((x) => x.toString()), separator) });
|
10
|
+
});
|
11
|
+
};
|