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

Wrong ID in rendered Javascript prevents EditableColumn from working #149

Closed
synatree opened this issue Nov 22, 2014 · 5 comments
Closed
Labels

Comments

@synatree
Copy link

I've got an EditableColumn defined in a Grid in the following way:

    [
                'class' => 'kartik\grid\EditableColumn',
                'attribute' => 'bEnabled',
                'editableOptions' => function ($model, $key, $index){
                        return [
                                'header' => 'Status',
                                'size' => 'md',
                                'inputType' => Editable::INPUT_SWITCH,
                                'displayValueConfig' => ['0'=>'Off', '1'=>'On'],
                        ];
                },
                'refreshGrid' => true,
    ],

However, the page is rendered with the following JS (only the problematic line is included):

jQuery('#bEnabled-0').editable(editable_2cc45c8b)

The actual ID for the enclosing element is not bEnabled-0, but bEnabled-0-cont.

@synatree
Copy link
Author

Interestingly, the hashVar contains the correct value.

var editable_2cc45c8b = {"containerId":"bEnabled-0-cont","defaultValue":"<em>(not set)<\/em>","placement":"right","target":".kv-editable-link","displayValueConfig":["Off","On"],"showAjaxErrors":true};

With yii2-grid 1.6.0, the hashVar that contains the pluginOptions no longer includes the containerId.

Even when the correct element is supplied to the .editable() call, the submit button handler never fires when the button is clicked. I don't know what I'm doing wrong, or if this is a bug. Everything was working at one point, and now suddenly the editable column seems to be mightily messed up.

@kartik-v
Copy link
Owner

The editable plugin is designed to be initialized on the editable input (inside the popover) and not on the container. So this is expected behavior. In fact there were some issues with the older implementation and hence there have been enhancements.

I hope you have upgraded to the latest release of yii2-editable and yii2-grid via composer. Related issue resolved recently.

@kartik-v
Copy link
Owner

You need to ensure you clean up your web assets and browser cache and restart/retry to remove any stale javascript/assets from old version.

@kartik-v kartik-v reopened this Nov 22, 2014
@kartik-v
Copy link
Owner

I am working on updating this release. Please hold on.

@kartik-v
Copy link
Owner

Upgrade to latest release. You can check the grid demo of usage of two editable columns including one with TouchSpin widget.

Also importantly refer this web tip on setting up the editable column for manipulating records.

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

2 participants