Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
jqGrid Slow Rendering
30/10/2014
23:19
Avatar
rnadam@goodmannetworks.com
Member
Members
Forum Posts: 4
Member Since:
14/07/2014
sp_UserOfflineSmall Offline

I want to you take a look at the below given jQuery Grid code and let me know why rendering takes more than 90 seconds. I would greatly appreciate your response

 

<script src="../../../_layouts/Scripts/jqgrid/jquery.min.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/jquery.multiselect.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/jquery.multiselect-erichynds.com.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/jquery.multiselect.filter.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/grid.locale-en.js" type="text/javascript"></script>
<script src="../../../_layouts/Scripts/jqgrid/jquery.jqGrid.src.js" type="text/javascript"></script>

<script type="text/javascript">
var idleTime = 0;
$(document).ready(function () {
//Increment the idle time counter every minute.
var idleInterval = setInterval(timerIncrement, 60000); // 1 minute
$(this).mousemove(function (e) {
idleTime = 0;
});
$(this).keypress(function (e) {
idleTime = 0;
});
});
function drawszlider(ossz, meik) {
$("#list").hide();
$("#szlider").show();
}
function timerIncrement() {
idleTime = idleTime + 1;
if (idleTime > 15) {
window.location.reload();
}
}
</script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
var gridInfo;
function pointercursor(cellvalue, options, rowObject) {
var new_formatted_cellvalue = '<span class="pointer">' + cellvalue + '</span>';
return new_formatted_cellvalue;
}
function createCookie(name, value, days) {
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name, "", -1);
}
function showCommentsDialogLink() {
return "<a href='javascript:void(0)' >View</a>";
// return "<a href='javascript:DisplayCommentsDialog()'>View Comments</a>";
}

function DisplayCommentsDialog(ID, projectid, tumsType, ptn, CommentsWorklist) {

var options = {
url: SP.Utilities.Utility.getLayoutsPageUrl('SharepointApp_jQueryTUMS/ShowComments.aspx?id=' + ID + '&projectid=' + projectid + '&tumsType=' + tumsType + '&PTN=' + ptn + '&CommentsWorklist=' + CommentsWorklist),
title: 'Comments',
allowMaximize: false,
showClose: true,
width: 1040,
height: 600,
dialogReturnValueCallback: Function.createDelegate(null, function () { $("#list").jqGrid('resetSelection'); })
};
SP.UI.ModalDialog.showModalDialog(options);
}
function CloseCallback(result, target) {
location.reload(true);
}

function showDialogForHighLevel(id, element) {
var projectids = new Array();
var ptn;
var turf;
var quote;
var tumsType;
var ismanual;
var readyForMSAct;
var bChosen = false;
$("#list").find('input[type=checkbox]').each(function () {
if ($(this).is(':checked')) {
turf = $(this).closest("tr").find('td:eq(3)').text();
projectids.push($(this).closest("tr").find('td:eq(2)').text());
ptn = $(this).closest("tr").find('td:eq(6)').text();
tumsType = $(this).closest("tr").find('td:eq(9)').text();
ismanual = $(this).closest("tr").find('td:eq(47)').text();
readyForMSAct = $(this).closest("tr").find('td:eq(14)').text();
bChosen = true;
}
});
if (!bChosen) { alert('Choose atleast one item to proceed'); return; }
var options = {
url: SP.Utilities.Utility.getLayoutsPageUrl('SharepointApp_jQueryTUMS/ShowHighLevelListUpdate.aspx?ptn=' + ptn + '&tums=' + tumsType + '&ismanual=' + ismanual + '&projectids=' + projectids.join(",")),
title: 'Edit High Level List info',
allowMaximize: false,
showClose: true,
width: 1040,
height: 600,
dialogReturnValueCallback: Function.createDelegate(null, CloseCallback)
};
SP.UI.ModalDialog.showModalDialog(options);
}
function getUniqueNames(columnName) {
var texts = $("#list").jqGrid('getCol', columnName);
var uniqueTexts = [];
var textsLength = texts.length;
var text;
var textsMap = {};
var i;
for (i = 0; i < textsLength; i++) {
text = texts[i];
if (text !== undefined && textsMap[text] === undefined) {
// to test whether the texts is unique we place it in the map.
textsMap[text] = true;
uniqueTexts.push(text);
}
}
uniqueTexts.sort(compare);
return uniqueTexts;
}
var myData_wcf = [{ Turf: "", Project: "", Program: "", PTN: "", Site_ID: "", FAID: "", TUMS: "", TUMS_Status: "", TUMS_Aging: "", Ready_for_TUMS: "", Ready_for_MS_Actualization: "", MS_Date_Actualized: "", MS_Date_Un_Actualized: "", Quote: "", Doc_Deliverables_Complete: "", Oracle_True_Up_Complete: "", Financial_Analysis_CL: "", OOM_Submitted: "", Customer_Quote_Complete: "", Project_Manager: "", Customer: "", Comments: "", MS_Date_Forecast: "", Lease_Fully_Exec_Fcst: "", Lease_Fully_Exec_Act: "", BP_Received_Fcst: "", BP_Received_Act: "", Site_Acq_Comp_Fcst: "", Site_Acq_Comp_Act: "", Tower_Wk_Comp_Fcst: "", Tower_Wk_Comp_Act: "", Const_Comp_Fcst: "", Const_Comp_Act: "", On_Air_Fcst: "", On_Air_Act: "", Turnover_Comp_Fcst: "", Turnover_Comp_Act: "", Cust_Accept_Fcst: "", Cust_Accept_Act: "", Previously_Un_Actualized: "", Goodman_Project_Status: "", Customer_Project_Status: "", IsManual: "", Created: "", Modified: ""}];
var myData_Obj;
$grid.jqGrid({
datatype: 'local',
data: myData_wcf,
colNames: ['ID', 'Turf', 'Project', 'Program', 'PTN', 'Site ID', 'FAID', 'TUMS', 'TUMS Status', 'DNKO', 'IssueCode', 'TUMS Aging', 'Ready for TUMS', 'Ready for MS Actualization', 'MS Date Actualized', 'MS Date Un Actualized', 'Quote', 'Doc Deliverables Complete', 'Oracle True Up Complete', 'Financial Analysis CL', 'OOM Submitted', 'Customer Quote Complete', 'Project Manager', 'Customer', 'Comments', 'MS Date Forecast', 'Lease Fully Exec Fcst', 'Lease Fully Exec Act', 'BP Received Fcst', 'BP Received Act', 'Site Acq Comp Fcst', 'Site Acq Comp Act', 'Tower Wk Comp Fcst', 'Tower Wk Comp Act', 'Const Comp Fcst', 'Const Comp Act', 'On Air Fcst', 'On Air Act', 'Turnover Comp Fcst', 'Turnover Comp Act', 'Cust Accept Fcst', 'Cust Accept Act', 'Previously Un Actualized', 'Goodman Project Status', 'Customer Project Status', 'IsManual', 'Created', 'Modified', 'IsControlsUser'],

rowNum: getRowNum(),
rowList: [5, 10, 15, 20, 25],
pager: '#pager',
gridview: true,
ignoreCase: true,
rownumbers: true,
multiSort: true,
sortname: 'Turf,Program,Modified',
viewrecords: true,
sortorder: 'desc',
multiselect: true,
resizeStop: function () {
var $grid = $(this.bDiv).find('>div:first>table.ui-jqgrid-btable:first'),
shrinkToFit = $grid.jqGrid('getGridParam', 'shrinkToFit');
$grid.jqGrid('setGridWidth', this.newWidth, shrinkToFit);
},
caption: " eTUMS New Display Model",
height: '120%',
width: '100%',
onCellSelect: function (rowid, index, contents, event) {
var prjID = $('#list').jqGrid('getCell', rowid, 'ID');
var project = $('#list').jqGrid('getCell', rowid, 'Project');
var tumsType = $('#list').jqGrid('getCell', rowid, 'TUMS');
var ptn = $('#list').jqGrid('getCell', rowid, 'PTN');
var CommentsWorklist = 'WorklistComments';
if (contents.toString().indexOf(' View ') > 0)
DisplayCommentsDialog(prjID, project, tumsType, ptn, CommentsWorklist);
},
onSelectRow: function (rowid) {

},
onSelectAll: function (aRowids, status) // this function is used when you select all check box
{
if (status) {
for (var i = 0; i < aRowids.length; i++) {
if ($("#jqg_list_" + aRowids[i]).attr("disabled")) {
$("#jqg_list_" + aRowids[i]).removeAttr("checked");
} else {
$("#divButtons").show();
}
}
}
},
loadComplete: function () {
$("tr.jqgrow:odd").css("background", "#EFF3FB");
var ids = jQuery("#list").jqGrid('getDataIDs');
var columnsNotInSearch = new Array();
var postData = $("#list").jqGrid('getGridParam', 'postData');
var postDataStr = JSON.stringify(postData);
var cm = $(this).jqGrid('getGridParam', 'colModel'), i, l = cm.length;
for (i = 0; i < l; i += 1) {
if (postDataStr.indexOf(cm[i].name) == -1 & cm[i].name != 'ID' & cm[i].name != 'rn' & cm[i].name != 'cb') {
columnsNotInSearch.push(cm[i].name);
}
}
for (var i = 0; i < ids.length; i++) {
var rowId = ids[i];
var TaskStatus = jQuery("#list").jqGrid('getCell', rowId, 'TUMS_Status');
var IsControlsUser = jQuery("#list").jqGrid('getCell', rowId, 'IsControlsUser');
if ((TaskStatus.indexOf('Progress') == -1 & TaskStatus.indexOf('New') == -1 & TaskStatus.indexOf('Rejected') == -1) | IsControlsUser.toLowerCase() == 'false') {
jQuery("#jqg_list_" + rowId).attr("disabled", true);
}
}
eraseCookie('rownum');
createCookie('rownum', $grid.jqGrid('getGridParam', 'rowNum'), 0);
$("#list").show();
$("#szlider").hide();
$("#divButtons").show();
},
beforeRequest: function (rowid, e) {
modifySearchingFilter.call(this, ',');
if ($("#jqg_list_" + rowid).attr("disabled")) {
return false;
}
return true;
}
});
$grid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true, defaultSearch: myDefaultSearch });
$grid.jqGrid('navGrid', '#pager', { refresh: false, edit: false, add: false, del: false }, {}, {}, {}, {
multipleSearch: true
});
$grid.jqGrid('navButtonAdd', "#pager", {
caption: "", title: "Reload Grid", buttonicon: "ui-icon-refresh",
multipleSearch: true,
multipleGroup: true,
recreateFilter: true,
onClickButton: function () {
gridInfo = new Object();
gridInfo.rowNum = $grid.jqGrid('getGridParam', 'rowNum');
$grid.jqGrid('setGridParam', { search: false });
eraseCookie('rownum');
createCookie('rownum', gridInfo.rowNum, 0);
location.reload(true);
}
});
});

</script>
</head>
<body onload="drawszlider(121, 56);">
<table id="list" style="display:none;" ><tr><td/></tr></table>
<div id="pager" ></div>
<div id="divButtons" style="display:none;" >
<table>
<tr>
<td><input id="btnEditHighLevelList" type="submit" value="Edit High Level List"
onclick="showDialogForHighLevel('divupdateHighLevelList,this');return false;"
/></td>
</tr>
</table>
</div>
<div id="szlider" style="position: absolute;top: 50%;left: 50%;margin-top: -50px;margin-left: -50px;width: 300px;height: 600px;">
<h1>Please wait .....</h1><br />
<img src="../../../_layouts/images/SharePointApp_jQueryTUMS/waiting_animation.gif" alt="" />
</div>
</body>
</html>

31/10/2014
15:56
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

 

The reason for this can be 100. 

The code you have posted is a very long, so it is very difficult to tell you where is the reason.

The reason can be on server query and etc.

 

I recommend you to construct very very basic grid - only data and colmodel definition.

If the result is ok (quick load), then you can step by step add the other code in order to see where is the problem.

 

Kind Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

04/11/2014
16:52
Avatar
rnadam@goodmannetworks.com
Member
Members
Forum Posts: 4
Member Since:
14/07/2014
sp_UserOfflineSmall Offline

tony said
Hello,

 

The reason for this can be 100. 

The code you have posted is a very long, so it is very difficult to tell you where is the reason.

The reason can be on server query and etc.

 

I recommend you to construct very very basic grid - only data and colmodel definition.

If the result is ok (quick load), then you can step by step add the other code in order to see where is the problem.

 

Kind Regards

Thanks Tony...Infact I could  not post the whole content of the page as there is limitation on no. of characters to post. I have 45 columns (some strings and some dates)  to display and USERS wanted unique values to be displayed for multi select on each column and I believe I do not have any extra processing other than building the jQuery Grid. I sent emails with whole code in it. Could you please kindly check and let me know If I can improve on speed 

05/11/2014
05:18
Avatar
rnadam@goodmannetworks.com
Member
Members
Forum Posts: 4
Member Since:
14/07/2014
sp_UserOfflineSmall Offline

If I take Multi Search option I see lightning speed in rendering the page. i.e. I had only string fields to display

e:  { name: 'Turf', width: 50, align: 'center' },

Where as when I add back search functionality it got slowed down

{ name: 'Project', width: 80, align: 'center', formatter: 'select',
edittype: 'select',
editoptions: {
value:uniqueprojectIds,
multiple: true
},
stype: 'select',
searchoptions: {
sopt: ['eq', 'ne'],
value: uniqueprojectIds,
attr: { multiple: 'multiple', size: 4 },
dataInit: dataInitMultiselect
}
},

 

Is there anything went wrong with this following code piece ? I appreciate your help

 

$(function () {

'use strict';

$grid = $("#list"),
myDefaultSearch = "cn",
getColumnIndexByName = function (columnName) {
var cm = $(this).jqGrid('getGridParam', 'colModel'), i, l = cm.length;
for (i = 0; i < l; i += 1) {
if (cm[i].name === columnName) {
return i; // return the index
}
}
return -1;
},
modifySearchingFilter = function (separator) {
var i, l, rules, rule, parts, j, group, str, iCol, cmi, cm = this.p.colModel,
filters = $.parseJSON(this.p.postData.filters);
if (filters && filters.rules !== undefined && filters.rules.length > 0) {
rules = filters.rules;
for (i = 0; i < rules.length; i++) {
rule = rules[i];
iCol = getColumnIndexByName.call(this, rule.field);
cmi = cm[iCol];
if (iCol >= 0 &&
((cmi.searchoptions === undefined || cmi.searchoptions.sopt === undefined)
&& (rule.op === myDefaultSearch)) ||
(typeof (cmi.searchoptions) === "object" &&
$.isArray(cmi.searchoptions.sopt) &&
cmi.searchoptions.sopt[0] === rule.op)) {
// make modifications only for the 'contains' operation
parts = rule.data.split(separator);
if (parts.length > 1) {
if (filters.groups === undefined) {
filters.groups = [];
}
group = {
groupOp: 'OR',
groups: [],
rules: []
};
filters.groups.push(group);
for (j = 0, l = parts.length; j < l; j++) {
str = parts[j];
if (str) {
// skip empty '', which exist in case of two separaters of once
group.rules.push({
data: parts[j],
op: rule.op,
field: rule.field
});
}
}
rules.splice(i, 1);
i--; // to skip i++
}
}
}
this.p.postData.filters = JSON.stringify(filters);
}
},
dataInitMultiselect = function (elem) {
setTimeout(function () {
var $elem = $(elem), id = elem.id,
inToolbar = typeof id === "string" && id.substr(0, 3) === "gs_",
options = {
selectedList: 2,
height: "300",
checkAllText: "all",
uncheckAllText: "no",
noneSelectedText: "Any",
open: function () {
var $menu = $(".ui-multiselect-menu:visible");
$menu.width("auto");
return;
}
},
$options = $elem.find("option");
if ($options.length > 0 && $options[0].selected) {
$options[0].selected = false; // unselect the first selected option
}
if (inToolbar) {
options.minWidth = 'auto';
}
$elem.multiselect(options).multiselectfilter({ placeholder: '' });
$elem.siblings('button.ui-multiselect').css({
width: inToolbar ? "98%" : "100%",
marginTop: "1px",
marginBottom: "1px",
paddingTop: "3px"
});
}, 50);
};

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
36 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information