quand on ajout dans l'url &_id=45, maintenant gamutable affiche la bonne page de l'element 45
This commit is contained in:
parent
1c3a41a2a8
commit
1fa801ce92
3 changed files with 49 additions and 9 deletions
|
@ -23,6 +23,7 @@
|
|||
includespip="#ENV{includespip}"
|
||||
ref="montableau"
|
||||
filtrer="#ENV{filtrer}"
|
||||
_id="#ENV{_id}"
|
||||
></mon-tableau>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -46,6 +47,8 @@
|
|||
includespip="#ENV{includespip}"
|
||||
ref="montableau"
|
||||
filtrer="#ENV{filtrer}"
|
||||
affichage_id="#ENV{_id}"
|
||||
_id="#ENV{_id}"
|
||||
></mon-tableau>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -57,9 +60,7 @@
|
|||
ajout de la classe: select sur le tr
|
||||
]
|
||||
<script type="text/javascript">
|
||||
var $_id = #ENV{_id,0};
|
||||
$_id = parseInt($_id);
|
||||
var nomBlocAjaxReload = '';
|
||||
let nomBlocAjaxReload = '';
|
||||
</script>
|
||||
|
||||
[(#CONFIG{gamutable/version_js}|=={dev}|?{
|
||||
|
|
|
@ -201,6 +201,9 @@ let monTableau = {
|
|||
filtrer: {
|
||||
type: String,
|
||||
},
|
||||
_id: {
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
data: function () {
|
||||
return {
|
||||
|
@ -485,12 +488,27 @@ let monTableau = {
|
|||
|
||||
Vue.nextTick(() => {
|
||||
this.chargement = false;
|
||||
if ($_id > 0) {
|
||||
this.selectLigne($_id, 'id');
|
||||
if (parseInt(this._id) > 0) {
|
||||
let _id = parseInt(this._id);
|
||||
let parPage = parseInt(this.tparpage[0]);
|
||||
if (parseInt(parPage)) {
|
||||
let ordre = 0;
|
||||
Object.values(this.table).forEach((d, i) => {
|
||||
if (_id === d.html.id) {
|
||||
ordre = i + 1;
|
||||
}
|
||||
});
|
||||
if (ordre > parPage) {
|
||||
let numPage = parseInt(ordre / parPage) + 1;
|
||||
this.page = numPage;
|
||||
}
|
||||
}
|
||||
this.selectLigne(_id, 'id');
|
||||
let url = new URL(window.location);
|
||||
url = url.href.replace('&_id=' + $_id, '');
|
||||
url = url.href.replace('&_id=' + _id, '');
|
||||
history.pushState({}, null, url);
|
||||
}
|
||||
|
||||
if (this.nomblocajaxreload) {
|
||||
ajaxReload(this.nomblocajaxreload);
|
||||
}
|
||||
|
|
|
@ -251,6 +251,9 @@ var monTableau = {
|
|||
},
|
||||
filtrer: {
|
||||
type: String
|
||||
},
|
||||
_id: {
|
||||
type: String
|
||||
}
|
||||
},
|
||||
data: function data() {
|
||||
|
@ -562,12 +565,30 @@ var monTableau = {
|
|||
Vue.nextTick(function () {
|
||||
_this4.chargement = false;
|
||||
|
||||
if ($_id > 0) {
|
||||
_this4.selectLigne($_id, 'id');
|
||||
if (parseInt(_this4._id) > 0) {
|
||||
var _id = parseInt(_this4._id);
|
||||
|
||||
var parPage = parseInt(_this4.tparpage[0]);
|
||||
|
||||
if (parseInt(parPage)) {
|
||||
var ordre = 0;
|
||||
Object.values(_this4.table).forEach(function (d, i) {
|
||||
if (_id === d.html.id) {
|
||||
ordre = i + 1;
|
||||
}
|
||||
});
|
||||
|
||||
if (ordre > parPage) {
|
||||
var numPage = parseInt(ordre / parPage) + 1;
|
||||
_this4.page = numPage;
|
||||
}
|
||||
}
|
||||
|
||||
_this4.selectLigne(_id, 'id');
|
||||
|
||||
var _url = new URL(window.location);
|
||||
|
||||
_url = _url.href.replace('&_id=' + $_id, '');
|
||||
_url = _url.href.replace('&_id=' + _id, '');
|
||||
history.pushState({}, null, _url);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue