我有一个jqGrid加载一些数据。
我的表现最好达到15个寄存器。当我收到超过15个寄存器时,加载时间增加20 - 30 - 40秒。
来自服务器的数据在2或3秒内到达,之后我认为jqgrid一直在加载数据。数据来自ajax,我使用php和json编码生成它。
这是我的代码。我试过grdview:是的,但时间是一样的。我已经尝试过没有格式化程序并使用普通数据,时间也是一样的。我需要一些帮助。
由于
<script>
$(function() {
$( "[title]" ).tooltip({});
var onoff='off';
//tabla listado de tareas
jQuery("#task_list_una").jqGrid
({
url:'json/avisos_wl_tasklist_json.php?tipo=una&new_call=<?=$_GET[CALL_ID]?>&rango_fechas=<?= $_GET[rango_fechas]?>&product_line=<?= $_POST[product_line]?>&user_actual=<?= $_POST[user_actual]?>&fecha_ini=<?= $date_from?>&ver_borrados=<?= $_GET[ver_borrados]?>&search_customer=<?= $_POST[search_customer_code]?>&search_serial=<?= $_POST[search_serial]?>',
datatype: "json",
colNames:['','<?= lang("CALL_ID"); ?>','<?= lang("CALL_DATE"); ?>', '<?= lang("CALL_TIME"); ?>', '<?= lang("STATUS"); ?>','<?= lang("PRODUCT_LINE"); ?>','<?= lang("PRODUCT_FAMILY"); ?>','<?= lang("USER_CREADOR"); ?>','<?= lang("CUSTOMER_CODE"); ?>','<?= lang("CUSTOMER_NAME"); ?>','<?= lang("DEPARTAMENTO"); ?>','<?= lang("TELF_PRIN"); ?>','<?= lang("TELF_MOVIL"); ?>','<?= lang("CONT_NOMBRE"); ?>','<?= lang("AVISO_ST"); ?>','<?= lang("EMAIL"); ?>','','','','','','','',''],
colModel:[
{name:'title_resumen',index:'title_resumen',hidden:true},
{name:'CALL_ID',index:'CALL_ID', width:30, align:"center",sorttype:"int", formatter:new_call_unaFormat, title:false},
{name:'CALL_DATE',index:'CALL_DATE', width:30, align:"center",sorttype:"date", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CALL_DATE]?>'}},
{name:'hora',index:'CALL_TIME', width:20, align:"center", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CALL_TIME]?>'}},
{name:'estado',index:'CAMPO05', width:25, align:"center", formatter:estado_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CAMPO05]?>'}},
{name:'linea',index:'CAMPO17', width:15, align:"center", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CAMPO17]?>'}},
{name:'producto',index:'CAMPO07', width:25, align:"center", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CAMPO07]?>'}},
{name:'CAMPO29',index:'CAMPO29', width:35, align:"center", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CAMPO29]?>'}},
{name:'codigo_cliente',index:'CUSTOMER_CODE', width:25 , align:"center", formatter:new_call_unaFormat, title:false, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CUSTOMER_CODE]?>'}},
{name:'nombre_cliente',index:'CUSTOMER_NAME', width:75 , align:"center", title:false, formatter:nombre_cliente_unaFormat, searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CUSTOMER_NAME]?>'}},
{name:'departamento',index:'DEPARTAMENTO', width:75 , formatter:new_call_unaFormat, align:"center", searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[DEPARTAMENTO]?>'}},
{name:'telefono1',index:'TELF_PRIN', width:35 , formatter:telefono1Format, align:"center", searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[TELF_PRIN]?>'}},
{name:'telefono2',index:'TELF_MOVIL', width:35 , formatter:telefono2Format, align:"center", searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[TELF_MOVIL]?>'}},
{name:'nombre_contacto',index:'CONT_NOMBRE', width:50, formatter:new_call_unaFormat, align:"center", searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[CONT_NOMBRE]?>'}},
{name:'aviso_st',index:'AVISO_ST', width:35 , formatter:new_call_unaFormat, align:"center", searchoptions:{defaultValue:'<?= $_SESSION["login_user"]->BUSQUEDA_TASK_LIST[AVISO_ST]?>'}},
{name:'log_mail',index:'log_mail', width:15, align:"center"},
{name:'index_resumen_altalt',index:'index_resumen_altalt',hidden:true},
{name:'title_nombre_cliente',index:'title_nombre_cliente',hidden:true},
{name:'color_new_call',index:'color_new_call',hidden:true},
{name:'color_estado',index:'color_estado',hidden:true},
{name:'telefono1_sincolor',index:'telefono1_sincolor',hidden:true},
{name:'telefono2_sincolor',index:'telefono2_sincolor',hidden:true},
{name:'popup',index:'popup',hidden:true},
{name:'popup2',index:'popup2',hidden:true},
],
toolbarfilter:true,
navigator:true,
search:false,
rowNum:-1,
pager: '#task_list_una_pager',
pgbuttons: false, // disable page control like next, back button
pgtext: null, // disable pager text like 'Page 0 of 10'
sortname: 'CALL_ID', //poner index para ordenar
viewrecords: true,
sortorder: "desc",
caption:"<?= lang("TAREA");?>",
height:'540',
width:'1480',
exporfile: 'texto.xls',
altRows:true, //para pijama
altclass:'myAltRowClass', //color pijama css
scrollrows:true,
gridview: true,
gridComplete: function()
{
$("[title]").tooltip({});
if (<?= $_GET[rowidjqgrid]?>+15>$("#task_list_una").getGridParam("reccount"))
{
$("#task_list_una").jqGrid('setSelection',<?= $_GET[rowidjqgrid]?>);
}
else
{
$("#task_list_una").jqGrid('setSelection',<?= $_GET[rowidjqgrid]?>+15);
}
$("#task_list_una").jqGrid('resetSelection');
}
});
jQuery("#task_list_una").jqGrid('filterToolbar',{searchOnEnter : false});
jQuery("#task_list_una").jqGrid('navGrid','#task_list_una_pager',{"edit": false,"add": false,"del": false,"search": true,"refresh": false,"view": true,"excel": true,"columns": false},
{},
{},
{},
{multipleSearch:false},
{
beforeShowForm: function(form)
{
var dlgDiv = $("#viewmod" + $("#task_list_una")[0].id);
var parentDiv = dlgDiv.parent();
var dlgWidth = dlgDiv.width();
var parentWidth = parentDiv.width();
var dlgHeight = dlgDiv.height();
var parentHeight = parentDiv.height();
var parentTop = parentDiv.offset().top;
var parentLeft = parentDiv.offset().left;
dlgDiv[0].style.top = Math.round( parentTop + (parentHeight-dlgHeight)/2 +100) + "px";
dlgDiv[0].style.left = Math.round( parentLeft + (parentWidth-dlgWidth )/2 ) + "px";
}
}
);
jQuery("#task_list_una").jqGrid('navButtonAdd','#task_list_una_pager',{
caption:"",
onClickButton: function () {
jQuery("#task_list_una").jqGrid('excelExport', {url: 'json/avisos_wl_tasklist_exportxls.php?tipo=una&new_call=<?=$_GET[CALL_ID]?>&rango_fechas=<?= $_GET[rango_fechas]?>&product_line=<?= $_POST[product_line]?>&user_actual=<?= $_POST[user_actual]?>&fecha_ini=<?= $date_from?>&fuera=<?= $_POST[fuera]?>&ver_borrados=<?= $_GET[ver_borrados]?>&search_customer=<?= $_POST[search_customer_code]?>&search_serial=<?= $_POST[search_serial]?>'});
},
position: "last",
buttonicon: "ui-icon-extlink"});
jQuery("#task_list_una").jqGrid('navButtonAdd','#task_list_una_pager',{
caption:"",
title:"Clear filters",
onClickButton: function () {
jQuery("#task_list_una").jqGrid('setGridParam', { search: false, postData: { "filters": ""} }).trigger("reloadGrid");
$("form[name='refresh']").submit();
},
position: "last",
buttonicon: "ui-icon-refresh"});
});
</SCRIPT>