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

PrintProviderField broken for text boxes #363

Closed
geographika opened this issue Sep 16, 2015 · 2 comments
Closed

PrintProviderField broken for text boxes #363

geographika opened this issue Sep 16, 2015 · 2 comments

Comments

@geographika
Copy link
Member

In /~https://github.com/geoext/geoext2/blob/master/src/GeoExt/plugins/PrintProviderField.js the onFieldChange accepts 2 arguments.

When a textbox is used the change event passes in 3 arguments.

{
    xtype: "textfield",
    name: "mapTitle", // printProvider.customParams.mapTitle
    fieldLabel: "Map Title",
    plugins: new GeoExt.plugins.PrintProviderField({
    printProvider: printProvider
})

me.fireEvent('change', me, newVal, oldVal);

This means the records parameter has the new value of the textbox as a string, and as it is not an array it is set to the record value.

As record is then always evaluates to true the printProvider.customParams[field.name] = value; is never called.

I guess a workaround could be to check if records is a string?

    onFieldChange: function(field, records) {
        var record;
        if (Ext.isArray(records)) {
            record = records[0];
        } else {
            record = records; // set to string of textbox
        }
        var printProvider = this.printProvider || field.ownerCt.printProvider;
        var value = field.getValue();
        this._updating = true;
        if(record) {
            switch(field.store) {
                case printProvider.layouts:
                    printProvider.setLayout(record);
                    break;
                case printProvider.dpis:
                    printProvider.setDpi(record);
                    break;
                case printProvider.outputFormats:
                    printProvider.setOutputFormat(record);
                default:
                // no op
            }
        } else {
            // never called
            printProvider.customParams[field.name] = value;
        }
        delete this._updating;
    }
@marcjansen
Copy link
Member

Do you think ypu can create a PR?

@chrismayer
Copy link
Contributor

Closed by #364

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

No branches or pull requests

3 participants