pjax

Backbone.js - how to include an external HTML fragment

时光毁灭记忆、已成空白 提交于 2019-12-13 00:57:50
问题 I have pre-rendered HTML fragments in my filesystem. Is it possible to load HTML fragments in backbone.js ? I'm looking for something similar to ng-include of Angular.js for example, in my file system (frag.html) <h1>I'm a fragment</h1> Should be injected to the template in a given placeholder location <div id="ph"> <!-- INJECTED --> <h1>I'm a fragment</h1> </div> 回答1: Suppose, we have this placeholder: <div id="ph"></div> and this HTML in frag.html file: <div> <h1>I am</h1> <span>an HTML

Yii2 Pjax Delete not working

为君一笑 提交于 2019-12-12 10:44:15
问题 I am trying to make an Ajax GridView using Pjax with delete button. Deleting goes with no Ajax. I am new to Yii2 so any help would be appreciated. Thank you. index.php <?php Pjax::begin(['id' => 'countries']) ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'id', 'title', ['class' => 'yii\grid\ActionColumn', 'buttons' => [ 'delete' => function ($url, $model, $key) { return Html::a('<span class="glyphicon glyphicon-trash"></span>',

How to update widget with pjax in modal window in yii2

眉间皱痕 提交于 2019-12-12 07:20:12
问题 I have two ActiveForms in a modal window and after submitting first form, I need to update second one and stay in modal. As I understand pjax can handle that, but can't get it to work properly. In _form.php I have ActiveForm with widget wich should be updated: <?php $form = ActiveForm::begin([ 'id'=>'form', 'enableAjaxValidation'=>true, ]); ?> <?= Html::activeHiddenInput($riskModel, 'id', ['value' => $riskModel->id]) ?> <?php Pjax::begin([ 'id' => 'solutionItems', ]) ?> //need to update this

How to enable touch events on pjax library?

◇◆丶佛笑我妖孽 提交于 2019-12-12 05:48:59
问题 I am developing a site where I use Pjax library (a port of jquery pjax). However the touch events don't go through. I am using Pjax like so: var pjax = new Pjax({ selectors: ["head title", "body"] }) and also have some animations: document.addEventListener('pjax:send', function(){ var $main = document.querySelector('main') $main.style.opacity = 0 }) document.addEventListener('pjax:complete', function(){ var $main = document.querySelector('main') $main.style.visibility = 'hidden' $main.style

Binding to ViewModel on PJax PostBack

ぃ、小莉子 提交于 2019-12-11 12:51:40
问题 I have a viewModel that I want to bind to pjax postback action: public class MyViewModel { public MySetting mySetting{ get; set; } public IList<MyDetail> myDetails{ get; set; } } This is the function I want to hit to handle the postBack [HttpPost] public ActionResult SaveMySettings(MyViewModel viewModel) { viewModel.mySettings; // This populate fine viewModel.myDetails; // Is NULL // handle saving here return this.PAjax("myPage", null, viewModel); } My custom classes are generated using

PJAX and Firefox back button issue

↘锁芯ラ 提交于 2019-12-11 10:16:48
问题 I'm testing jquery.pjax.js and noticed a problem. In my minimum test project, strange behavior like below happens: Access to index.php in fireflx Click a pjax link: location bar and page contents are changed Click Firefox's back button: location bar is changed but contents remain This behavior doesn't happen in GoogleChrome. I want to know how to solve this. My test project is: http://karasunouta.com/php_test/pjax/ http://karasunouta.com/files/pjax.zip index.php <?php $page = 1; if (isset($

PJax not working with MVC project

我只是一个虾纸丫 提交于 2019-12-11 09:23:24
问题 I've followed the samples. I added a _PjaxLayout: <title>@ViewBag.Title</title> @RenderBody() Modified my _Layout: <div id="shell"> @RenderBody() </div> <script type="text/javascript"> $(function () { // pjax $.pjax.defaults.timeout = 5000; $('a').pjax('#shell'); }) </script> Updated ViewStart: @{ if (Request.Headers["X-PJAX"] != null) { Layout = "~/Views/Shared/_PjaxLayout.cshtml"; } else { Layout = "~/Views/Shared/_Layout.cshtml"; } } Yet every time I click on an 'a' tag, the pjax code

Execute page-specific javascript code after PJAX success

血红的双手。 提交于 2019-12-11 01:08:17
问题 Here's my conundrum: My website uses PJAX to load HTML into the '#main' container for each page. Each page has its own specific javascript file. E.g: 'dashboard.index.js', 'inbox.index.js' and so on. Note: All libraries are preloaded on the first load of the page through PreloadJS to avoid javascript compilation overhead. The first load of the page is perfect, no worries, since it is a normal HTML load. However if i come back to this page again, PJAX won't reload the javascript file, given it

jquery pjax with php. no content at reload

纵然是瞬间 提交于 2019-12-10 19:32:38
问题 I try to use jquery pjax to load my contents in a div. this works fine, but if i reload the page i have no content. i think i need to put the page content in the else{ part, but i don't want to set the whole html in a php variable. how to fix this? index.php: <?php $title = 'Home'; if(isset($_SERVER['HTTP_X_PJAX']) && $_SERVER['HTTP_X_PJAX'] == 'true'){ ?> <div id="content"> <h1>home</h1> </div> <?php echo "<title>{$title}</title>"; }else{ include 'wrapper.php'; } ?> wrapper.php: <ul class=

How to refresh pjax listview in yii2? It reloads the entire page

自作多情 提交于 2019-12-10 13:46:37
问题 I want to be able to refresh a pjax listview without refreshing the whole page. This is the view just the pjax list itself. <?= Html::Button('refresh-countries', ['class' => 'btn btn-primary', 'name' => 'login-button', 'id'=>'refresh']) ?> <?php Pjax::begin(['id' => 'countries']) ?> <?= ListView::widget([ 'dataProvider' => $dataProvider, 'itemOptions' => ['class' => 'comment-item'], 'itemView' => 'commentadapter', ]); ?> <?php Pjax::end() ?> Please I want it to refresh onclick of that button