EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
May 07, 2024, 05:57:58 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
>
Is it correct behavior of datagrid?
Pages: [
1
]
« previous
next »
Print
Author
Topic: Is it correct behavior of datagrid? (Read 7203 times)
volodias
Newbie
Posts: 8
Is it correct behavior of datagrid?
«
on:
October 06, 2013, 10:29:47 PM »
Hello!
Please, check if the behavior of datagrid is correct. Or I do not understand something...
If I un-comment lines 1,2 and 3 - I get on the server side 3 requests to the database, not 1 as I expect! Why it is so?
If I use only lines 2 and 3 - thus, I see 2 database requests...
If I use line 4 - I see only 1 database request, just what is needed.
What can be wrong? If I add any code like $('#dg').datagrid - I get an extra database request, what is very unexpected.
//1 $('#dg').datagrid({showHeader: false});
//2 $('#dg').datagrid({ url: 'jrnact.php?ent=inc' });
//3 $('#dg').datagrid('load',{ eid: value });
//4 $('#dg').datagrid({ url: 'jrnact.php?ent=inc', queryParams: { eid: value} });
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: Is it correct behavior of datagrid?
«
Reply #1 on:
October 07, 2013, 01:33:39 AM »
Calling $('#dg').datagrid({ url: 'jrnact.php?ent=inc' }) will create datagrid and make a request('jrnact.php').
Calling $('#dg').datagrid('load',{ eid: value }) will make a new request with new parameter value.
Calling $('#dg').datagrid({ url: 'jrnact.php?ent=inc', queryParams: { eid: value} }) will create datagrid again and make a request.
Logged
volodias
Newbie
Posts: 8
Re: Is it correct behavior of datagrid?
«
Reply #2 on:
October 07, 2013, 02:26:46 AM »
I have a datagrid created from markup.
The code of the lines1..4 is in the function which "feeds" this datagrid with data.
How then to be sure that only one database request will be done?
Unfortunately, do not very understand why my datagrid has to be created with every selector statement?
Even if I like just to change only a property of the datagrid? - $('#dg-jrn').datagrid({showHeader: false});
What I have...
-------------------------------------------------------------------------------
<table id="dg-jrn" title="Journal" class="easyui-datagrid" pagination="true" rownumbers="true" >
<thead>
<tr>
<th field="jrn_dat" >Date</th>
<th field="jrn_usrid" formatter=fmtUser>User</th>
<th field="jrn_rec" >Text</th>
</tr>
</thead>
</table>
----------------------------------------------------------------------------------
function editRecord(){
var row = $('#dg-jrn').datagrid('getSelected');
if (row){
idn = row.inc_idn;
$('#inc_form').form('clear');
....
incLoadJrn(row.inc_id);
....
url = 'incact.php?act=update';
}
}
----------------------------------------------------------------------
function incLoadJrn(value){
//1 $('#dg-jrn').datagrid({showHeader: false});
//2 $('#dg-jrn').datagrid({ url: 'jrnact.php?ent=inc' });
//3 $('#dg-jrn').datagrid('load',{ eid: value });
//4 $('#dg-jrn').datagrid({ url: 'jrnact.php?ent=inc', queryParams: { eid: value} });
}
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...