Skip to content

Add DataCollection guides #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open

Conversation

mafanya23
Copy link
Contributor

No description provided.

@mafanya23 mafanya23 requested a review from Sorokin-Oleg March 11, 2025 08:21
@@ -13,7 +13,7 @@ description: You can explore the changeId method of DataCollection in the docume
@params:
- `id: string | number` - the old id of an item
- `newId: string | number` - optional, the new id; auto-generated if not set
- `silent: boolean` - true, to prevent changing the id; otherwise, false
- `silent: boolean` - optional, *true*, to prevent changing the id; otherwise, *false*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 кажется тут не то описание. silent - если использовать метод с включенным данным флагом, метод будет работать в "тихом" режиме, то есть - без вызова событий. Метод сработает, события будут проигнорированы.

- `permanent: boolean` - optional, *true* to make the current filter permanent. It will be applied even if the next filtering doesn't have the `add:true` property in its configuration object. Such a filter can be removed just with the [resetFilter()](data_collection/api/datacollection_resetfilter_method.md) method
- `silent: boolean` - optional, if *true*, the update of the DataCollection state won't trigger the component repainting, *false* by default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 откуда тут перерисовка?)) Это частный случай, а может и сработает. Можно в примечаниях написать, что:

после использования данного метода с включенным флагом silent вам потребуется принудительная перерисовка компонента при помощи метода paint()

Флаг silent вызывает метод без вызова событий.

@@ -30,7 +30,7 @@ const item = component.data.find(function(item){
});

//searching for an item by the attribute key
const item = component.data.find({by:"text",match:"Manager"});
const item = component.data.find({ by:"text",match:"Manager" });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 понимаю, что правка локальная. Если есть возможность, поправ пожалуйста отступы в примерах:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 почти во всех примерах есть такая проблема

@@ -14,7 +14,7 @@ description: You can explore the getLength method of DataCollection in the docum
The number of elements of a data collection.

@example:
component.data.getLength();
const items = component.data.getLength();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 метод возвращает длину коллекции. Название переменной можно было назвать dataLength

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 по описанию подавлю. В TreeCollection этот метод коварен, и вместо длинны всех данных отобразит длину уровня. Вроде есть об этом запись в TreeCollection. Но я подумал, что в гайдах стоит упомянуть, если не будешь делать отдельный гайд по TreeCollection

@@ -8,20 +8,21 @@ description: You can explore the reduce method of DataCollection in the document

@short: reduces the array to a single value

@signature: {'reduce(callback: (acc: any, item: any) => any, acc: any): any;'}
@signature: {'reduce(callback: (acc: any, item: any, index?: number) => any, acc: any): any;'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 index не опционален.


**Related sample**: [Data. Parse](https://snippet.dhtmlx.com/0zrxtmvi)

## Checking whether data is loaded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 Хорошо, мы проверяем загруженные данным. А как мы их загрузили? Нет описания ленивой загрузки.

grid.data.save("http://userurl/");

//or
grid.data.save(new DataProxy({ url:"http://userurl/" }));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 это ведь тоже к загрузке относится, в гайде инфы нет DataProxy


~~~jsx
// creating a new grid
const grid2 = new dhx.Grid(document.body);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 будет просто ошибка. Grid без свойства columns не инициализируется

@@ -0,0 +1,321 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 все примеры необходимо привести в порядок

@@ -0,0 +1,182 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mafanya23 описание с методов тут не годится. Это просто дублирование информации. Про фильтрацию есть, что рассказать и показать. Особенно про smartSorting, которая по факту мультисортировка. Есть даже примеры в snippet tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants