Forum


22:48

04/11/2010

Is there a way to force form edit to call the dataUrl for a select list each time it is opened? I have two tabs with one grid on each tab. In the grid on tab #1, I enter values that are used in a select list in the grid on tab #2 so I will need the most up to date values for the select list.
The first time I open the form it makes the call to the server to get the select list, but for each successive open of the form it gets the data from cache. When I am in inline edit this isn't an issue since it calls the server each time for the select list.
Thanks for your help.
00:34

10/08/2009

Do you use recreateForm:true option? If not yet, try it. Probably it will solve your problem.
Best regards
Oleg
20:25

04/11/2010

I thought this is working, but it is not after entering recreateForm: true. When I open the roles add form it shows the current list of entities and then I will close the roles add form. Then I will go to the entity grid and add another entity and then go back to the roles grid and open the add form and the newly added entity does not show up in the list and the server-side function Home/ListEntities is not called. What I am looking for is to have /Home/ListEntities called each time the add form is opened.
Thanks for your help.
Here is the code for the roles grid:
var lastSelRole;
var lastRoleRowData;
var roleRowCount;
$("#grdRoles").jqGrid({
url: '/Home/GetPartnerRoles',
datatype: "json",
mtype: 'POST',
height: 'auto',
width: 'auto',
colNames: ['EntityRoleId', 'Entity Name', 'Role', 'Partner', 'Relationship Lead', 'Status', 'Date Entered', 'Date Entered Orig', 'Entered By'],
colModel: [
{ name: 'EntityRoleId', index: 'EntityRoleId', editable: false, hidden: true, key: true },
{ name: 'EntityName', index: 'EntityName', width: 150, editable: true, edittype: 'select', editoptions: { dataUrl: '/Home/ListEntities' } },
{ name: 'Role', index: 'Role', width: 250, editable: true, align: 'left', edittype: 'select', editoptions: { dataUrl: '/Home/ListRoles'} },
{ name: 'Partner', index: 'Partner', width: 150, editable: true },
{ name: 'RelationshipLead', index: 'RelationshipLead', width: 150, editable: true },
{ name: 'Status', index: 'Status', width: 80, editable: true, edittype: 'select', editoptions: { dataUrl: '/Home/ListRiskEnumeration?groupName=Status'} },
{ name: 'DateEntered', index: 'DateEntered', width: 100, editable: true, edittype: 'custom', editoptions: { custom_element: disabledInput, custom_value: elementValue} },
{ name: 'DateEnteredOrig', index: 'DateEnteredOrig', hidden: true, editable: true, editrules: { edithidden: true} },
{ name: 'EnteredBy', index: 'EnteredBy', width: 100, editable: true, edittype: 'custom', editoptions: { custom_element: disabledInput, custom_value: elementValue} }
],
rowNum: 10,
rowList: [10, 20, 30],
pager: '#pgrRoles',
sortname: 'Role',
viewrecords: true,
sortorder: "desc",
onSelectRow: function (id) {
roleRowCount = $("#grdRoles").getGridParam("reccount");
if ((id && id != lastSelRole) || roleRowCount == 1) {
if (lastSelRole != null) {
var rowData = $("#grdRoles").jqGrid('getRowData', lastSelRole);
if (!ArraysEqual(lastRoleRowData, rowData)) {
$("#grdRoles").jqGrid('saveRow', lastSelRole);
} else {
$("#grdRoles").jqGrid('restoreRow', lastSelRole);
}
} else {
$("#grdRoles").jqGrid('restoreRow', lastSelRole);
}
$("#grdRoles").jqGrid('editRow', id, true, onRoleRowEdit, '', '/Home/SavePartnerRole', '', '', onRoleSaveError);
lastSelRole = id;
}
},
loadError: function (xhr, status, error) {
var obj = $.parseJSON(xhr.responseText);
$("#roleErrorLabel").css("display", "");
$("#roleError").html(obj.ErrorMessage);
},
errorTextFormat: function (data) {
if (data.responseText.substr(0, 6) == "<html ") {
return $(data.responseText).html();
}
else {
var obj = $.parseJSON(data.responseText);
return obj.ErrorMessage;
}
},
editurl: '/Home/SavePartnerRole',
caption: "Roles"
});
$("#grdRoles").navGrid("#pgrRoles", { add: true, edit: false, del: false, search: false },
{
// edit options
},
{ // add options
width: 350,
recreateForm: true,
beforeShowForm: function (form) {
$('#tr_DateEntered', form).hide();
$('#tr_DateEnteredOrig', form).hide();
$('#tr_EnteredBy', form).hide();
},
errorTextFormat: function (data) {
if (data.responseText.substr(0, 6) == "<html ") {
return $(data.responseText).html();
}
else {
var obj = $.parseJSON(data.responseText);
return obj.ErrorMessage;
}
},
closeAfterAdd: true
}
);
Most Users Ever Online: 715
Currently Online:
64 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66