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

refreshGrid takes effect on every column. #253

Closed
zhjyii opened this issue Mar 18, 2015 · 4 comments
Closed

refreshGrid takes effect on every column. #253

zhjyii opened this issue Mar 18, 2015 · 4 comments

Comments

@zhjyii
Copy link

zhjyii commented Mar 18, 2015

I added 'refreshGrid' => true to one of the editable column, expecting the grid refresh takes place only when editing on that column, but editing other columns also trigers grid refresh. Is it a bug or expected behaviour? If it is expected is it possible to achieve what I want to achieve?
Thanks,
Jian

@kartik-v
Copy link
Owner

The refreshGrid should technically be applicable only for a particular editable column - unless you have a duplicate input identifier generated by using the same model and attribute in another column.

@zhjyii
Copy link
Author

zhjyii commented Mar 18, 2015

Well, I think I set each of my column different attribute.
I checked the page source code and found the following function is
generated when 'refreshGrid' is enabled on any one column:

jQuery("#w4").find('.kv-editable-input').each(function() {
var $input = $(this);
$input.on('editableSuccess', function(){
jQuery("#w4").yiiGridView("applyFilter");
});
});

All my editable columns has .kv-editable-input class, so I think that is
the cause.
I only set the refreshGrid on a column, why it doesn't use that input's id,
but rather .kv-editable-input class?
One of such column is as below:
<input type="text" id="profile-0-name" class="kv-editable-input
form-control" name="Profile[0][name]" value="gg">

Thanks,
Jian

On 18 March 2015 at 17:07, Kartik Visweswaran notifications@github.com
wrote:

The refreshGrid should technically be applicable only for a particular
editable column - unless you have a duplicate input identifier generated by
using the same model and attribute in another column.


Reply to this email directly or view it on GitHub
#253 (comment).

@kartik-v
Copy link
Owner

Will submit an enhancement for this soon - also the Editable widget needs to be enhanced.

@zhjyii
Copy link
Author

zhjyii commented Mar 19, 2015

Thanks, the code below seems to confirm the behaviour:
if ($this->refreshGrid) {
$view = $this->grid->getView();
$grid = 'jQuery("#' . $this->grid->options['id'] . '")';
$script = <<< JS
{$grid}.find('.kv-editable-input').each(function() {
var $input = $(this);
$input.on('editableSuccess', function(){
{$grid}.yiiGridView("applyFilter");
});
});
JS;
$view->registerJs($script);
}

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

No branches or pull requests

2 participants