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

Object grid filters on all relation fields #3031

Closed
psuhane opened this issue Jul 6, 2018 · 2 comments
Closed

Object grid filters on all relation fields #3031

psuhane opened this issue Jul 6, 2018 · 2 comments
Labels

Comments

@psuhane
Copy link

psuhane commented Jul 6, 2018

Improvement

It would be great if in object grid have filters available for all the relation fields - Object relation, Object with metadata, Href, Multi-href, Multi-href advanced. The same interface can be used that is being used for Batch Update in object grid, in addition to that if AND/OR operator can be handled. Please refer following screen

relation

@fashxp fashxp added the Priority label Oct 1, 2018
@BlackbitDevs
Copy link
Contributor

BlackbitDevs commented Aug 7, 2019

For this we need to implement an own filter type (based on https://docs.sencha.com/extjs/6.2.1/classic/Ext.grid.filters.filter.Base.html) which opens the field layout in a modal window (as batch editing does). ExtJS does not provide an "action filter" or anything like that.

Or we use a string filter with a focus event. The filter panel appears if you enter the following to abstractRelations.js:

getGridColumnFilter: function (field) {
        return {
            type: 'string',
            dataIndex: field.key,
            itemDefaults: {
                listeners: {
                    'focus': function() {
                        var filter = this;
                        var tag = new pimcore.object.tags[field.type](null, field.layout);
                        var win = new Ext.Window({
                            autoScroll: true,
                            modal: false,
                            bodyStyle: "background: #fff;",
                            width: 500,
                            maxHeight: 400,
                        });
                        var formPanel = Ext.create('Ext.form.Panel', {
                            xtype: "form",
                            border: false,
                            items: [tag.getLayoutEdit()],
                            bodyStyle: "padding: 10px;",
                            buttons: [
                                {
                                    text: t("filter"),
                                    handler: function() {
                                        if(formPanel.isValid()) {
                                            filter.setValue(JSON.stringify(formPanel.getValues()));
                                            this.close();
                                        }
                                    }.bind(win)
                                }
                            ]
                        });
                        win.add(formPanel);
                        win.show();
                        win.updateLayout();
                    }
                }
            }
        };
    },

But I have not found a way to set the value to the filter. The variable "filter" in the above code is only the text input field, not the filter. And instantiating a Ext.grid.filters.filter.String object also fails because the grid does not exist yet.

@fashxp
Copy link
Member

fashxp commented Oct 29, 2019

duplicate of #699

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

No branches or pull requests

3 participants