Skip to content
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

Fix: Filter for relation throws an error #741

Merged
merged 5 commits into from
Nov 6, 2024
Merged

Conversation

blankse
Copy link
Contributor

@blankse blankse commented Nov 5, 2024

Fix: #720

@kingjia90 kingjia90 linked an issue Nov 5, 2024 that may be closed by this pull request
@kingjia90 kingjia90 added the Bug label Nov 5, 2024
@kingjia90 kingjia90 added this to the 1.6.2 milestone Nov 5, 2024
@kingjia90 kingjia90 self-assigned this Nov 5, 2024
@kingjia90
Copy link
Contributor

kingjia90 commented Nov 6, 2024

There is still something not right, maybe we should introduce also a minimum width?
image

@blankse
Copy link
Contributor Author

blankse commented Nov 6, 2024

@kingjia90 What did you config as width?

@kingjia90
Copy link
Contributor

kingjia90 commented Nov 6, 2024

it's the default value in demo instance, i believe it's empty it's 96 but don't know from where it comes
image

@blankse
Copy link
Contributor Author

blankse commented Nov 6, 2024

@kingjia90 I changed it again 1bddd12
There are so many width keys in this fieldInfo object. I hope this is the right one. In my tests it works now.

@kingjia90
Copy link
Contributor

kingjia90 commented Nov 6, 2024

weird, to me it doesn't work, it's the default 700, the table within the dialog seems crammed and not utilizing/distributing the width for each grid column

image

@blankse
Copy link
Contributor Author

blankse commented Nov 6, 2024

@kingjia90 What did you set as the width? I entered 1000 in this field in the demo, and it is now wider. Yes, the columns are narrow, but I believe that’s because they are empty at the beginning.

@blankse
Copy link
Contributor Author

blankse commented Nov 6, 2024

@kingjia90 I cleared the browser cache/cookies. Now the column widths also correct. Extjs saves the widths of the columns in the local storage:
image
image

Copy link

sonarqubecloud bot commented Nov 6, 2024

@kingjia90
Copy link
Contributor

@kingjia90 What did you set as the width? I entered 1000 in this field in the demo, and it is now wider. Yes, the columns are narrow, but I believe that’s because they are empty at the beginning.

i didn't set anything, that should be right, nevermind, it is just fine

@kingjia90 I cleared the browser cache/cookies. Now the column widths also correct. Extjs saves the widths of the columns in the local storage: image image

ahhh didn't know that... does it implicitly mean that we cannot use variable width and should be always fixed?

@blankse
Copy link
Contributor Author

blankse commented Nov 6, 2024

@kingjia90 It's not from ext js. It is here in the admin-ui-classic-bundle:

columns = Ext.Array.map(columns, function(column) {
let columnWidth = this.getColumnWidth(column.dataIndex);
if (columnWidth > 0) {
column.width = columnWidth;
}
if (typeof column.width !== "undefined") {
delete column.flex;
}
if(typeof column.listeners === "undefined") {
column.listeners = {};
}
column.listeners.resize = function (columnKey, column, width) {
localStorage.setItem(this.getColumnWidthLocalStorageKey(columnKey), width);
}.bind(this, column.dataIndex);
return column;
}.bind(this));
return columns;
},

getColumnWidthLocalStorageKey: function (column) {
let context = this.context;
delete context.objectId;
context.column = column;
return Object.values(context).join('_');
},
getColumnWidth: function (column) {
let width = parseInt(localStorage.getItem(this.getColumnWidthLocalStorageKey(column)));
if (width > 0) {
return width;
}
return null;
}

You have first open the filter with the very small window. So the columns was saved small. You can drag and drop the widths wider and it should be saved for the next window, right? When you have a empty local storage the columns have a correct width.

@kingjia90
Copy link
Contributor

kingjia90 commented Nov 6, 2024

It seems it's because the grid is likely empty on first time opening as "Filter by relation" and therefore it doesn't have an estimation on how long each column would be. Ideally we should trigger this resize with localStorage.setItem on selecting/adding the first element

The current PR changes LGTM

@kingjia90 kingjia90 merged commit aca7f3f into pimcore:1.6 Nov 6, 2024
10 checks passed
@blankse blankse deleted the patch-1 branch November 6, 2024 13:36
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Filter for relation throws an error
3 participants