I have an igGrid as follows:
<%= Html.Infragistics().Grid(Model.Subjects) .ID("teamSubjectGrid") .RenderCheckboxes(true) .PrimaryKey("SubjectId") .UpdateUrl(Url.Action("SaveTeamData")) .Columns(column => { column.For(x => x.SubjectId).HeaderText("").Width("20px").Hidden(true); column.For(x => x.SubjectName).HeaderText("Name").Width("250px"); column.For(x => x.SubjectTag).HeaderText("Id").Width("200px"); column.For(x => x.fTeamMember).HeaderText("Member").Width("100px").DataType("bool"); ; }).Features(features => { features.Paging().Type(OpType.Local).PageSize(10); features.Selection().Mode(SelectionMode.Row).MultipleSelection(false); features.Filtering().Type(OpType.Local); features.Updating().EnableAddRow(false).EditMode(GridEditMode.Row).EnableDeleteRow(false).ColumnSettings(columnSettings => { columnSettings.ColumnSetting().ColumnKey("SubjectId").ReadOnly(true); columnSettings.ColumnSetting().ColumnKey("SubjectName").ReadOnly(true); columnSettings.ColumnSetting().ColumnKey("SubjectTag").ReadOnly(true); columnSettings.ColumnSetting().ColumnKey("fTeamMember"); }); }) .Height("500px") .DataSource(Model.Subjects) .DataBind().Render()%>
The javascript that gets run when a user presses a Save button below the grid is as follows:
function saveChanges() { // // First check we have a team name // teamName = $("#teamNameEntry").val(); if (!teamName) { alert("Please provide a team name"); return; } var webMethod = new String('/KDT/UpdateTeamName'); var parameters = "{'teamId':'" + currentTeamIdString + "', 'teamName':'" + escape(teamName) + "'}";
$.ajax( { type: 'Post', url: webMethod, data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert("about to call save Changes"); $("#teamSubjectGrid").igGrid("saveChanges"); alert("called save Changes"); $("#editTeamDialog").igDialog('close'); window.location = '/KDT/Teams/' + currentTeamIdString; }, error: function (e) { alert("Sorry there was a problem saving your changes. Please try again."); } });
return true; }
On all browsers the two debug alerts are shown, and in IE 7/8/9/10, Chrome and Firefox the Update Url SaveTeamData is called with no problem.
However using Safari on both a Mac and Windows while the alerts are shown, the Update Url is never called.
I'm using igGrid on another page with the exact same behaviour, IE/Chrome/Firefox are fine, Safari does not call the update url.
I'm using the latest 13.1, fully patched, with jQuery 1.7.2. Safari v5.1.7 on Windows 8 64bit. We've tried Safari on a couple of different Macs and it has the same problem.
Does anyone have any ideas why Safari would not work?
Thanks
Richard
Hello Richard ,
Thank you for posting in our forum.
I’ve tested this on my side on Safari on Windows version . The exact safari version is 5.1.7 (7534.57.2).
The sample uses the latest version of 13.1: 13.1.20131.2217.
On my side it shows the alert and triggers the UpdateUrl as expected when you call the saveChanges method.
Could you test it on your side and let me know whether it works on your side? If the project does not work correctly, this indicates either a problem possibly specific to your environment or a difference in the IG version you’re using. It would be helpful if you can let me know on which versions of Safari you’re testing this.
If the sample is working correctly, this indicates a possible problem in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Hi,
Thanks for the fast response. I tried running that project. I initially had a version conflict with Newtonsoft.Json, I removed the local copy and it got past that. But I'm getting a very strange error when the loader runs. I've attached a screenshot of it.
I've had the original Update error in Safari 5.1.7 (7534.57.2) on my development PC, as well as on two different Macs (one mine, one a users). As far as I can tell I'm running 13.1.20131.2013. I'll try updating that to 2217 and see if that helps.
Regards
I upgraded to 2217 but it made no difference. But I can run tat sample project in Chrome and Safari, just not IE10.
It does work, though differently. In Chrome I get the Alert, acknowledge that and my break point is hit in the HomeController, in Visual Studio hit F5 to continue running and then I get the second alert.
In Safari I get the first alert, then the second alert, and then the breakpoint is hit.
I'm going to take out the Close Dialog in my main code as a test to see if the call gets made if I leave the dialog box open...
Thanks,
Regarding the error from the screenshot you attached on Sep 19.
This sometimes happened when referencing the scripts from the cdn. IE10 sometimes encodes the request like that.
However if you reference the script files locally from your machine it will work as expected.
If you have trouble running the sample you can change the references that point to the cdn:
<script src="http://cdn-na.infragistics.com/jquery/20131/latest/js/infragistics.loader.js"></script>
<%= Html.Infragistics().Loader()
.ScriptPath("http://cdn-na.infragistics.com/jquery/20131/latest/js")
.CssPath("http://cdn-na.infragistics.com/jquery/20131/latest/css")
.Render()
%>
To point to your local directory that has the css and js files instead.
I’ve tested attaching the _addChangesSuccessHandler on the button’s click event:
$("#saveBtn").click(function () {
$("#teamSubjectGrid").data("igGrid").dataSource._addChangesSuccessHandler(changesSuccess);
…
And in it I added and alert and reloaded the page:
function changesSuccess() {
alert("changes success");
window.location = "";
}
I fires after the updateUrl was called.
It gets called as expected on all browsers.
I’ve attached a sample with this event handler. Please test it on your side and let me know if you have any questions.
As mentioned if you happen to have any problems on IE change the references to the files to your local js and css folder.
Just to let you know I tried the addChangesSuccessHandler approach, but even though I could see it in the SaveChanges array when debugging my handler was never called.
So I did a workaround where I set a closePending flag when calling saveChanges, and then added a handler that was called whenever an Ajax call finished and if that flag was set it closed the dialog and refreshed the page. Clunky but it seems to work ok in IE/Chrome/Firefox and Safari.
Regards,Richard
Ok now I'm getting somewhere, it looks like in Safari the call to UpdateUrl is delayed compared to IE, Chrome and Firefox. If I remove the call to close the dialog box and refresh the page after the Save Changes then the Update URL is called.
So I then tried taking out just the close dialog and leaving the page refresh - Update was not called. If I leave in the close dialog and take out the refresh page then the Update is called after the dialog is closed. So it looks like Safari does not call SaveChanges if the page is refreshed, even after a UI delay with the alert boxes before the refresh page is called. Strange.
If the saveChanges fires an event after the Update Url is called then I should be able to trap on that event and close the dialog and refresh the page then.
Time to go check the documentation :)