Skip to content

T1280020 - DataGrid - The 'row' parameter in the FocusedRowChanged event refers to a non-focused row if the grid height is small#30678

Merged
Raushen merged 6 commits intoDevExpress:25_2from
Raushen:T1280020_25_2
Aug 14, 2025
Merged

T1280020 - DataGrid - The 'row' parameter in the FocusedRowChanged event refers to a non-focused row if the grid height is small#30678
Raushen merged 6 commits intoDevExpress:25_2from
Raushen:T1280020_25_2

Conversation

@Raushen
Copy link
Copy Markdown
Contributor

@Raushen Raushen commented Aug 8, 2025

No description provided.

@Raushen Raushen self-assigned this Aug 8, 2025
@Raushen Raushen requested a review from a team as a code owner August 8, 2025 11:26
key: any,
): DeferredObj<number | unknown> {
if (!isDefined(key)) {
this._resetFocusedRow();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question
Is _resetFocusedRow() sync? If not and there are some async ops inside, won't it be misleading that we don't wait for it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The method is sync


public _navigateToRow(key, needFocusRow?) {
public _navigateToRow(
key: any,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor
Afair, there was some export type Key = any
It will not change anything for TS, but let's still use it for better readability

this.option('focusedRowIndex', -1);
}
return this._navigateToRow(key);
return this._navigateToRow(key, false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Question
Why? Isn't it required to focus row when autoNavigateToFocusedRow is true?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is just a refactoring, I've added this argument to make method typing easier.
I think a row can be focused only if the row focusing is enabled. Also this method is related to the scrolling and can be used without focusing.


private _focusRowByKey(key) {
private _focusRowByKey(
key: any,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor
Let's use Key type (see another comment below)

focusedRowEnabled: true,
onFocusedRowChanged(e) {
const data = e.row?.data;
$('#otherContainer').text(data.id);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need a container to output data? Can't we remember the row object in the window? And check it as a whole to make sure it's valid?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It is more easier way for me. Surely you can use the window object but it will require more code,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well, okay, let's leave it as is.

public _navigateToRow(key, needFocusRow?) {
public _navigateToRow(
key: Key,
needFocusRow: boolean,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suggest setting this argument to a default value of false right away

Copy link
Copy Markdown
Contributor Author

@Raushen Raushen Aug 14, 2025

Choose a reason for hiding this comment

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

Why? It is a required argument now and its value defined at calling the method. Here is passing false.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, I'd like to suggest leaving this argument optional with a default value of false. That way you don't have to explicitly pass false when calling this method.
But I won't insist on this.

Alyar666
Alyar666 previously approved these changes Aug 14, 2025
@Raushen Raushen merged commit 7480fd8 into DevExpress:25_2 Aug 14, 2025
311 checks passed
Raushen added a commit to Raushen/DevExtreme that referenced this pull request Aug 18, 2025
…ent refers to a non-focused row if the grid height is small (DevExpress#30678)
Raushen added a commit to Raushen/DevExtreme that referenced this pull request Aug 18, 2025
…ent refers to a non-focused row if the grid height is small (DevExpress#30678)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants