render page without footer yii2 - yii2

I am trying render page in grid view, it was success but the footer is show on the column i render, how to remove its
This is the colomn GridView i write :
[ 'format' => 'raw',
'value' => function($model) { return "<p class='feedback'>". $model->KOMENTAR ."</p><br><p class='feedback-date'>". $model->TANGGAL ."</p><hr><div id='replay-". $model->ID_KOMENTAR."'><ul></ul><div id='replay-column'></div></div>";},
],
I render the page inside div class="replay-column"
This the following js i made for rendering page when i click button:
$("#replay-to-"+ID_KOMENTAR).on("click", function(){
$.get('index.php?r=feedback/feedbacktest',null, function(data){
$('#replay-column').append(data);
});
});
And this the controller :
public function actionFeedbacktest(){
echo $this->render('feedback_test');
}

Related

Yii2 - Why ajax change page in Listview with Pjax not working properly

I used listview with pjax block and this is my view page:
<div class="main-video">
<div>نمایش</div>
<div id="data">
<?php
$model = new ActiveDataProvider([
'query' => FileInfos::find()->where(['type' => 2])->orderBy(['id'=>SORT_DESC]),
'pagination' => [
'pageSize' => 15,
],
]);
Pjax::begin([
'id'=> 'id-pjax',
'enablePushState' => false, // to disable push state
'enableReplaceState' => false, // to disable replace state,
'timeout'=> 999999999
]);
if(isset($model))
echo ListView::widget([
'dataProvider' => $model,
'itemView' => '/partials/_item',
'viewParams' => ['typeName' => 'video'],
]);
Pjax::end();
?>
</div>
<button id="btn-show">نمایش</button>
</div>
And this is my action controller code:
public function actionVideo()
{
return $this->render('video');
}
After click on next page, it's reload on entire page.
in network tab of inspect element, I see two request calls:
1 - video?page=2&per-page=15&_pjax=%23id-pjax
2 - video?page=2&per-page=15
First request no have any response and second request have the rendered view page which reloads to that.
Whats wrong in my code?
How can I fix this issue for have ajax request call for changing page?
This article helped me: https://riptutorial.com/yii2/example/16529/how-to-use-pjax,
So it solved by changing pjax begin block with this code:
Pjax::begin([
'id'=> 'id-pjax-'.uniqid(),
'enablePushState' => false, // to disable push state
'enableReplaceState' => false, // to disable replace state,
'timeout'=> 999999999,
'clientOptions' => ['method' => 'POST']
]);

How to remove the "max-height" online style of modal?

I created a code that displays a link to open a modal window.
The problem is that the text comes out of the window.
When I inspect the code of my page, there is an online style style="max-height: 570px;"
If I add the following code to my style sheet, it works. But is there another solution? I make a mistake in my code :
div#drupal-modal--content[style] {
max-height: none !important;
}
How to remove the online style of modal ?
public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {
$store_name = $this->order->getStore()->getName();
$store_id = $this->order->getStoreId();
$pane_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
$attributes = [
'attributes' => [
'class' => 'use-ajax',
'data-dialog-type' => 'modal',
'data-dialog-options' => Json::encode([
'width' => auto,
]),
],
];

yii2 pjax inside other pjax

i have form with two pjax. (one inside two) when clicked link in second PJAX send query to server but in field "X-PJAX-Container" write ID first container.
Pjax::begin([
'id' => 'register-form'
]);
...
Pjax::begin([
'id' => 'que'
]);
echo yii\helpers\Html::a('update', ['/portal/que/gr-usl/');
Pjax::end();
...
Pjax::end();
location after click update : /portal/que/gr-usl?_pjax=%23register-form
request header
X-PJAX:true
X-PJAX-Container:#register-form
X-Requested-With:XMLHttpRequest
if set data-pjax for link #que request header not changed.
for all link in inside pjax disabled data-pjax an href change to onclick with function
$.pjax({url: $(el).attr('link'), container: '#pjax-grusl'});
links has code
echo yii\helpers\Html::a('update', null,[
'data-pjax' => 'false',
'link' => \yii\helpers\Url::to(['/portal/que/gr-usl/',
'ids' => $ids,
'filter' => $filter,
'gr' => $gr
]),
'onclick' => 'selGr(this)'
]);
but its should work from box :( i don't understand why click by link don't find first pjax container from dom tree.

using pjax for toasts without full refresh

Pjax for Alerts
There is alert.php included in layout file above $content. This is as below :
<?php Pjax::begin(['id'=> 'new-alert','enablePushState' => false]); ?>
<?= \odaialali\yii2toastr\ToastrFlash::widget([
'options' => [
'positionClass' => 'toast-bottom-full-width',
//'progressBar' => true,
'timeOut' => 6000,
'extendedTimeOut' => 2000
]
]);?>
<?php Pjax::end(); ?>
And to get flash messages in ajax , there are calls to below container
$.pjax.reload({container:'#new-alert'});
This results in showing of alert messages but also sends an Ajax request to URL whichever page is open. Can we trigger request to "/site/toast" on ajax calls which can renderAjax the above widget inplace of making ajax request on current url ?
Since there are no html "a" tag well as neither any "form" tag here inside widget generated html, Is this correct use of pjax ?
http://localhost:8081/about-us?_pjax=%23new-alert
Pjax for form
Also if we wrap an Active Form inside Pjax, how can we make sure that none of A tags or nested Form trigger a Pjax request except the container form ?
I have removed call for pjax from PHP and made alert as below -
<div id="new-alert">
<?= \odaialali\yii2toastr\ToastrFlash::widget([
'options' => [
'positionClass' => 'toast-bottom-full-width',
//'progressBar' => true,
'timeOut' => 6000,
'extendedTimeOut' => 2000
]
]); ?>
</div>
Instead I am making pjax call from javascript as below -
$.pjax({url: encodeURI(baseUri + "site/toast"), container: '#new-alert', push: false})
public function actionToast()
{
if(Yii::$app->request->getHeaders()->has('X-PJAX'))
{
return $this->renderAjax('//common/alert');
}
else
{
return $this->redirect(Yii::$app->request->referrer);
}
}
$.pjax.reload was previously retrieving additional toasts if there were some for current url as well. Above solution only gets toasts related to ajax.

yii2 switch button that render page with pjax

I'm trying to make a form that changes the input according to the button pressed, using pjax of yii2, no page loads.
My view
<div id="container-ajax">
<?php Pjax::begin([]);
echo $this->render('noleggia_andata', ['form' => $form, 'noleggi_partenza' => $noleggi_partenza]);
Pjax::end(); ?>
</div>
This is one, I tried with ActionView from Button but do not know how to do, can you give me any suggestions?
View
<?= Html::a("Go", ['noleggi/noleggia_andata'], ['class' => 'btn-discard-orange']) */ ?>
Controller
public function actionNoleggia_andata()
{
$noleggi_partenza = new Noleggi_partenza;
return $this->render('noleggia_andata',['noleggi_partenza' => $noleggi_partenza]);
}
Controller view rederAjax
public function actionNoleggia_andata()
{
$noleggi_partenza = new Noleggi_partenza;
return $this->renderAjax('noleggia_andata',['noleggi_partenza' => $noleggi_partenza]);
}