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

A quick hack to allow multiple container updates. #27

Open
stovesy opened this issue Nov 7, 2019 · 2 comments
Open

A quick hack to allow multiple container updates. #27

stovesy opened this issue Nov 7, 2019 · 2 comments

Comments

@stovesy
Copy link

stovesy commented Nov 7, 2019

Barely tested but it may work for you.

if ($this->pjaxContainer){
	if (is_array($this->pjaxContainer)){
		$firstContainer = $this->pjaxContainer[0];
		$expression[] = "$.pjax.reload({container : '$firstContainer', timeout : $this->pjaxTimeout });";
		for ($index = 0; $index < count($this->pjaxContainer)-1; $index++){
			$container = $this->pjaxContainer[$index];
			$nextContainer = $this->pjaxContainer[$index+1];
			$expression[] = sprintf('$(\'%s\').one(\'pjax:end\', function () {$.pjax.reload({container: \'%s\'});});', $container, $nextContainer);
		}
	}
	else
		$expression[] = "$.pjax.reload({container : '$this->pjaxContainer', timeout : $this->pjaxTimeout });";
}
@loveorigami
Copy link
Owner

Thanks. I am shall test it.

@loveorigami
Copy link
Owner

loveorigami commented Nov 18, 2019

How you planed use it? I use only string for $pjaxContainer

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

2 participants