EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
May 21, 2024, 11:15:45 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
EasyUI for jQuery
>
Stop the events of pagination
Pages: [
1
]
« previous
next »
Print
Author
Topic: Stop the events of pagination (Read 5471 times)
lomonmic
Newbie
Posts: 12
Stop the events of pagination
«
on:
January 14, 2020, 02:25:18 AM »
Hello, sorry if I use an automatic translator, but I don't speak English well.
I would need to stop paging when there is still data to save in datagrid remote.
Is it possible to stop the event and stay on the modified data page?
Thank you.
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Stop the events of pagination
«
Reply #1 on:
January 15, 2020, 01:50:58 AM »
Please show some code snippets and describe your question in more detail.
Logged
lomonmic
Newbie
Posts: 12
Re: Stop the events of pagination
«
Reply #2 on:
January 15, 2020, 02:24:02 AM »
Thanks for the reply.
I solved the problem this way (see code below)
but I would have preferred to block the event: onSelectPage. It can be done ?
Michele.
...
...
var pager = dd.datagrid('getPager');
var popts = pager.pagination('options');
var onSelectPage = popts.onSelectPage;
popts.onSelectPage = function(pageNumber, pageSize){
var rows = $('#tt').datagrid('getChanges');
alert(rows.length+' rows are changed!');
if(rows.length > 0)
{
var rc = confirm('Ci sono records da salvare. Confermi ?');
if(rc)
{
var dataString = JSON.stringify(rows) ;
var url = 'save.php';
$.ajax(url, {
type:'POST',
data: {myData: dataString},
success: function(data){
alert($.trim(data) );
},
error: function(){
alert('Errore');
}
});
}
onSelectPage.call(this, pageNumber, pageSize);
}
else
{
onSelectPage.call(this, pageNumber, pageSize);
}
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Stop the events of pagination
«
Reply #3 on:
January 15, 2020, 07:21:25 PM »
Please try to return false in the 'onBeforeSelectPage' event to stop paging. Be sure to download the newest version from the site.
Code:
pager.pagination({
onBeforeSelectPage(pageNumber,pageSize){
if (...){
return false;
}
}
})
Logged
lomonmic
Newbie
Posts: 12
Re: Stop the events of pagination
«
Reply #4 on:
January 16, 2020, 03:31:11 AM »
Thank you for your suggestion.
I downloaded version 1.9.3, but the onBeforeSelectPage event handler seems not to be handled.
Below the code that I tested that does not display the alert.
....
....
var pager = dd.datagrid('getPager');
var popts = pager.pagination('options');
var onBeforeSelectPage = popts.onBeforeSelectPage;
popts.onBeforeSelectPage = function(pageNumber, pageSize){
alert('ok');
return false;
}
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Stop the events of pagination
«
Reply #5 on:
January 16, 2020, 07:30:17 PM »
Please look at this example
https://www.jeasyui.com/demo/test/test9.html
. It works fine.
Logged
lomonmic
Newbie
Posts: 12
Re: Stop the events of pagination
«
Reply #6 on:
January 17, 2020, 12:35:50 AM »
Good morning,
I tried the example and I understand why I can't solve with my code. The example works in Firefox, IExplorer, but in Chrome it doesn't display the alert.
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Stop the events of pagination
«
Reply #7 on:
January 17, 2020, 06:48:00 PM »
It works fine in Chrome. Please try to refresh your page and make sure the newest 'jquery.easyui.min.js' file is loaded successfully.
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...