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

Ambiguous usage of pjax #386

Closed
bscheshirwork opened this issue Nov 6, 2018 · 8 comments
Closed

Ambiguous usage of pjax #386

bscheshirwork opened this issue Nov 6, 2018 · 8 comments
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Milestone

Comments

@bscheshirwork
Copy link
Contributor

What steps will reproduce the problem?

Use crud generator

What's expected?

pjax template exclude "create" button

    <p>
        <?= "<?= " ?>Html::a(<?= $generator->generateString('Create ' . Inflector::camel2words(StringHelper::basename($generator->modelClass))) ?>, ['create'], ['class' => 'btn btn-success']) ?>
    </p>

<?= $generator->enablePjax ? "    <?php Pjax::begin(); ?>\n" : '' ?>
<?php if(!empty($generator->searchModelClass)): ?>
<?= "    <?php " . ($generator->indexWidgetType === 'grid' ? "// " : "") ?>echo $this->render('_search', ['model' => $searchModel]); ?>
<?php endif; ?>

What do you get instead?

pjax template included "create" button

<?= $generator->enablePjax ? "    <?php Pjax::begin(); ?>\n" : '' ?>
<?php if(!empty($generator->searchModelClass)): ?>
<?= "    <?php " . ($generator->indexWidgetType === 'grid' ? "// " : "") ?>echo $this->render('_search', ['model' => $searchModel]); ?>
<?php endif; ?>


    <p>
        <?= "<?= " ?>Html::a(<?= $generator->generateString('Create ' . Inflector::camel2words(StringHelper::basename($generator->modelClass))) ?>, ['create'], ['class' => 'btn btn-success']) ?>
    </p>

<p>
<?= "<?= " ?>Html::a(<?= $generator->generateString('Create ' . Inflector::camel2words(StringHelper::basename($generator->modelClass))) ?>, ['create'], ['class' => 'btn btn-success']) ?>
</p>

Additional info

Q A
Yii version dev
PHP version 7.2.11
Database version
Operating system
@samdark
Copy link
Member

samdark commented Nov 10, 2018

Why should it exclude "create" button?

@bscheshirwork
Copy link
Contributor Author

This action is not a pjax action and can be place outside pjax container for avoid unnecessery redirect after pjax fail

@samdark
Copy link
Member

samdark commented Nov 11, 2018

OK. Could you send a pull request fixing it?

@samdark samdark added type:bug Bug status:ready for adoption Feel free to implement this issue. labels Nov 11, 2018
@SOHELAHMED7
Copy link
Contributor

Either we can go with @bscheshirwork or we can add a attribute data-pjax="0" link

@samdark
Copy link
Member

samdark commented Nov 11, 2018

Yes. Correct.

@SOHELAHMED7
Copy link
Contributor

Should I go ahead with PR?

@bscheshirwork
Copy link
Contributor Author

@SOHELAHMED7 @samdark

data-pjax="0"

is not a correct way for new project,
but this variant is safe for existing projects;
we can use css for nested rules.

@samdark
Copy link
Member

samdark commented Nov 11, 2018

@bscheshirwork agree.

alexkart added a commit to alexkart/yii2-gii that referenced this issue Feb 18, 2019
alexkart added a commit to alexkart/yii2-gii that referenced this issue Feb 18, 2019
alexkart added a commit to alexkart/yii2-gii that referenced this issue Feb 18, 2019
@samdark samdark added this to the 2.1.0 milestone Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:bug Bug
Projects
None yet
Development

No branches or pull requests

3 participants