iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Can someone provide me with an example on how to delete rows from a WebGrid using BatchUpdate using JavaScript? The following code doesn't seem to do anything? I would expect the row to disappear but show up in the grid's WebGridRowChanges collection
function WebGrid_GetSelectedRow(controlID) { try { // Get selected row var grid = ISGetObject(controlID); if (grid == null) { return; } var selObj = grid.GetSelectedObject(); if (selObj == null) { return; } return selObj.ToRowObject(); } catch (ex) { ShowJSException(ex); } } function WebGrid_DeleteSelectedRow(controlID) { try { // Delete selected row var row = WebGrid_GetSelectedRow(controlID); if (row == null) { return; } row.Delete(); } catch (ex) { ShowJSException(ex); } }
If you wish to remove newly added row during batchupdate, you will need to invoke UndoChanges method. The Delete method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using GetRowState function. Here is the snippet:
function DeleteRow() { var grid = ISGetObject("WebGrid1"); var selObj = grid.GetSelectedObject(); var rowObj = selObj.ToRowObject() if (rowObj.GetRowState() == "Added") rowObj.UndoChanges(); else rowObj.Delete();}
Hello,
When you delete a selected row, you would need to accept the pending changes.If you don't accept pending changes, all modified changes, should be still persisted in WebGrid.
Regards,Handy
Hello,When you delete a selected row, you would need to accept the pending changes.If you don't accept pending changes, all modified changes, should be still persisted in WebGrid.Regards,Handy
I called the WebGridRow's AcceptChanges() method but it didn't work. Can you be specific on what I need to do?
After you delete a row, you will need to call grid.AcceptAllChanges(). With this way, all changes would be saved into your database.
Hello,After you delete a row, you will need to call grid.AcceptAllChanges(). With this way, all changes would be saved into your database. Regards,Handy
I don't want to AcceptAllChanges. The user should be able to manipulate the grid including deleting rows which should remove them from the grid and put the appropriate data in the RowChanges collection until some event occurs. In this case, the trigger of a button.
TTT
Hello Shawn,
If you are using BatchUpdate scenario, all the changes should be indicated with flags or indicator.E.g Delete with delete icon, which the row should be not bot removed from Grid until It accept the changes. It's already the behaviour.If you want just remove the row from WebGrid instantly, you should not use BatchUpdate scenario.
Hello Shawn,If you are using BatchUpdate scenario, all the changes should be indicated with flags or indicator.E.g Delete with delete icon, which the row should be not bot removed from Grid until It accept the changes. It's already the behaviour.If you want just remove the row from WebGrid instantly, you should not use BatchUpdate scenario.Regards,Handy
I do not understand what you are saying. After the Row.Delete method is called, I don't notice anything different in the UI. How does the user know the row is deleted? They indicated they do not want to see it anymore (hence deleted). Also, leaving it visible indicates updates to the fields are still allowed.
We are using the BatchUpdate scenario for performance reasons. We want the user to be able to add/update/delete rows and then save when they choose to. However, leaving a deleted row visible is confusing to them. Is there a way to hide the row after the Delete method is called?
As I said before, it is our default behaviour in BatchUpdate.When you delete, it will also show you some flags. Please see my recording video. I don't understand why you did not notice the different in the UI.It should be easy to see.
However, if you want, you can hide it by set display style to none in the element.
e.g
grid.GetSelectedObject().ToRowObject().GetElement().style.display="none";
As I said before, it is our default behaviour in BatchUpdate.When you delete, it will also show you some flags. Please see my recording video. I don't understand why you did not notice the different in the UI.It should be easy to see.However, if you want, you can hide it by set display style to none in the element.e.g grid.GetSelectedObject().ToRowObject().GetElement().style.display="none"; Regards,Handy
That delete icon isn't visible after the Row is deleted. I am creating rows based on a button click but that shouldn't matter.
As you can see in my video, It should be appeared when you use batch update mode. There should be nothing like you said. All pending changes should be have flags.Or if you delete the new added row, the row should be dissapeared at once.So, Would you mind just send me your simple runable sample that showed the situation that you described?
As you can see in my video, It should be appeared when you use batch update mode. There should be nothing like you said. All pending changes should be have flags.Or if you delete the new added row, the row should be dissapeared at once.So, Would you mind just send me your simple runable sample that showed the situation that you described?Regards,Handy
I am using WebGrid version 7.0.7200.403.
As soon as it calms down, I will get you an example. My current work around is to use CSS to hide the row. The row's Delete() method puts it in the WebGridRowChanges so it is deleted as expected. It is odd that I do not need to call the AddPendingChanges() method like I need to for adding/updating row data using JavaScript.
To be clear, the row's Delete() method doesn't change the row icon as it remains a "+" to indicate a new row. It is also added to the WebGridRowChanges collection as discussed above without having to call the AddPendingChanges() method. I am not sure why the icon doesn't change as shown in your video.
Ok, I will wait for your sample. It seems we need to wait for your sample to see what the real problem is.
After calling the Row's Delete() method, the Row's GetRowState() method still indicates the row is 'Added'. Shouldn't it be 'Delete'? How can I tell which rows have been deleted or marked for deleted?
Normally, in batch update mode, when you called Delete() or delete manually by pressing 'delete' key in keyboard, the current row would be marked. As you can see in my video, there should delete icon indicator and would be added as pending changes.So, that's why I am confused why you insist to say that you could not see the indicator.Suggest a workaround to hide the row when use delete() also would not help much.Even though you hide the row, it is still added in pending changes.It would not go away from pending changes, except you have clicked accept or cancel the pending changes.Regards,Handy
I am not sure why the delete icon indicator isn't working for me either? The add icon indicator still appears.
Hiding the row is exactly what I want. The user deleted the row and doesn't want to see it anymore. I added the suggested code to HIDE it. After the page is submitted, I will be able to delete the row as it will be in the WebRowChanges collection.
This is a problem. A row that was created and then deleted still has a "GetRowState()" as "Added". After the postback, the WebRowChanges only has "Added" and not "Deleted" so the row is NEVER deleted.
If I just DELETE an existing row, the WebRowChanges has the delete and it works as expected.
As you have said before that you would get me a sample for this issue.I think it would be better for me to see the sample first. I need to replicate your issue to investigate your issue.
Hello Shawn,As you have said before that you would get me a sample for this issue.I think it would be better for me to see the sample first. I need to replicate your issue to investigate your issue.Regards,Handy
I updated an existing page in the WebGrid tutorial to show the two issues I have:
1) Click on the "Add 5 new rows and delete 2" button and it will show 5 rows in an Added RowState even though the first two should be deleted. The UI doesn't indicate that any rows are deleted. Highlight an existing row and click "Delete Selected Row". That will change the UI and indicate the RowState as Deleted. This is the same code that deletes rows in the "Add 5 new rows and delete 2" button.
2) Click on the "Add 5 new rows and delete 2" button and then click the "Check WebRowChanges". This will postback to the server. You will notice all 5 rows are still in an Added state.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BatchUpdateDeleteRow.aspx.cs" Inherits="BatchUpdateDeleteRow" %> <%@ Register TagPrefix="iswebgrid" Namespace="ISNet.WebUI.WebGrid" Assembly="ISNet.WebUI.WebGrid" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD runat=server> <title>BatchUpdateDeleteRow</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script language="javascript"> function WebGrid_SetFieldText(field, text, updateValueField) { try { // Set field's text // NOTE: Default the value to the text if flag is not specified if (field == null) { return; } if (typeof (updateValueField) == "undefined") { updateValueField = true; } field.SetText(text, updateValueField, true); } catch (ex) { ShowJSException(ex); } } function AddNewRowForceNewData() { var grdInurings = ISGetObject("WebGrid1"); // Create new row var newRow = grdInurings.RootTable.NewRow(); if (newRow == null) { return false; } // Default new row's data // NOTE: Scroll to row before new row to avoid lag from WebGrid loading more data (if exist) grdInurings.ClearSelection(); // Address var cells = newRow.GetCells(); var address = cells.GetNamedItem("Address"); if (address != null) { WebGrid_SetFieldText(address, ""); } // Customer ID var customerID = cells.GetNamedItem("CustomerID"); if (customerID != null) { window.alert("Why does this field need to be set for a new row when the ID is not set until the data is committed?"); var now = new Date(); WebGrid_SetFieldText(customerID, String((now.getSeconds() + now.getMilliseconds()))); } newRow.AddPendingChanges(); // Focus newRow.Select(); return true; } function AddNewRows(numOfNewRows, numOfDeleteRows) { var grdInurings = ISGetObject("WebGrid1"); if (typeof (numOfDeleteRows) == "undefined") { numOfDeleteRows = 0; } for (var index = 0; index < numOfNewRows; index++) { var newRow = AddNewRow(); if (index < numOfDeleteRows) { WebGrid_DeleteRow(newRow); } } return true; } function AddNewRow() { // Create new row var grdInurings = ISGetObject("WebGrid1"); var newRow = grdInurings.RootTable.NewRow(); if (newRow == null) { return false; } // Default new row's data // NOTE: Scroll to row before new row to avoid lag from WebGrid loading more data (if exist) grdInurings.ClearSelection(); // Address var cells = newRow.GetCells(); var address = cells.GetNamedItem("Address"); if (address != null) { WebGrid_SetFieldText(address, ""); } // Customer ID var customerID = cells.GetNamedItem("CustomerID"); if (customerID != null) { var now = new Date(); WebGrid_SetFieldText(customerID, String((now.getSeconds() + now.getMilliseconds()))); } newRow.AddPendingChanges(); return newRow; } function WebGrid_GetSelectedRow() { try { // Get selected row var grid = ISGetObject("WebGrid1"); if (grid == null) { return; } var selObj = grid.GetSelectedObject(); if (selObj == null) { return; } return selObj.ToRowObject(); } catch (ex) { ShowJSException(ex); } } function WebGrid_DeleteSelectedRow() { try { WebGrid_DeleteRow(WebGrid_GetSelectedRow()); } catch (ex) { ShowJSException(ex); } } function WebGrid_DeleteRow(row) { try { if (row == null) { return; } row.Delete(); row.AddPendingChanges(); var rowElement = row.GetElement(); //if (rowElement != null) { rowElement.style.display = "none"; } } catch (ex) { ShowJSException(ex); } } </script> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <input type="button" value="New Row Causing More Data To Load" onclick="javascript:AddNewRowForceNewData();" /> <input type="button" value="Add 5 new rows and delete 2" onclick="javascript:AddNewRows(5, 2);" /> <input type="button" value="Delete Selected Row" onclick="javascript:WebGrid_DeleteSelectedRow();" /> <input type="button" value="Add 10 new rows" onclick="javascript:AddNewRows(10);" /> <asp:button runat="server" Text="Check WebRowChanges" OnClick="PerformInuringsGridBatchUpdate" /> <iswebgrid:webgrid id=WebGrid1 runat="server" Height="279px" Width="896px" OnInitializeDataSource="WebGrid1_InitializeDataSource"> <LayoutSettings AutoHeight="false" AutoWidth="false" AllowBatchUpdate="true" BatchUpdateSettings-PromptUnsavedChanges="false" BatchUpdateSettings-AutomaticObjectUpdate="false" AllowEdit="Yes" EditOnClick="True" AllowAddNew="Yes" AllowDelete="Yes" PromptBeforeDelete="true" NewRowLostFocusAction="AlwaysPrompt" ResetNewRowValuesOnError="True" RowHeightDefault="22px" AllowFilter="Yes" AllowSelectColumns="Yes" AllowSorting="Yes" HideColumnsWhenGrouped="Default" AllowExport="Yes" InProgressUIBehavior="ChangeCursorToHourGlass" ApplyFiltersKey="Enter" AllowColumnFreezing="Yes" ShowFilterStatus="True" PagingMode="VirtualLoad" VerboseEditingInformation="False" FilterBarVisible="True" PagingExportMode="ExportAllData" CellPaddingDefault="0" AlwaysShowHelpButton="False" VirtualPageSize="25"> <HeaderStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" ForeColor="Black" Height="20px" Font-Size="8pt" Font-Names="Verdana" BorderColor="#ACA899"> <BorderSettings> <Left Color="White"></Left> <Top Color="White"></Top> </BorderSettings> </HeaderStyle> <FrameStyle BackColor="#F1EFE2"></FrameStyle> <GroupByBox> <LabelStyle BorderStyle="Solid" BorderWidth="1px" BackColor="White" Font-Size="8pt" Font-Names="Verdana" BorderColor="Navy"></LabelStyle> <Style BackColor="Gray"> </Style> </GroupByBox> <EditTextboxStyle BorderStyle="None" BorderWidth="0px" Font-Size="8pt" Font-Names="Verdana"></EditTextboxStyle> <NewRowStyle BackColor="White" ForeColor="DarkGray" Font-Size="8pt" Font-Names="Verdana"></NewRowStyle> <FocusCellStyle BorderStyle="Solid" BorderWidth="1px" BorderColor="Navy"></FocusCellStyle> <RowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="White" Font-Size="8pt" Font-Names="Verdana"></RowStyle> <GroupRowInfoStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#F1EFE2" Font-Size="8pt" Font-Names="Verdana" BorderColor="White"> <BorderSettings> <Bottom Color="Silver"></Bottom> <Right Color="Silver"></Right> </BorderSettings> </GroupRowInfoStyle> <SelectedRowStyle BackColor="LightSteelBlue"></SelectedRowStyle> <AlternatingRowStyle CustomRules="text-overflow: ellipsis; overflow-x: hidden" BackColor="AntiqueWhite" Font-Size="8pt" Font-Names="Verdana"></AlternatingRowStyle> <StatusBarStyle BorderStyle="Solid" BorderWidth="1px" BackColor="#ECE9D8" Font-Size="8pt" Font-Names="Verdana" BorderColor="#ACA899"> <Padding Bottom="2px" Left="2px" Top="2px" Right="2px"></Padding> </StatusBarStyle> <StatusBarCommandStyle> <Over BorderWidth="1px" BorderColor="Navy" BorderStyle="Solid" BackColor="CornflowerBlue"></Over> <Normal> <Padding Bottom="1px" Left="1px" Top="1px" Right="1px"></Padding> </Normal> <Active BackColor="RoyalBlue" BaseStyle="Over"></Active> </StatusBarCommandStyle> <PreviewRowStyle ForeColor="#0000C0"></PreviewRowStyle> </LayoutSettings> <RootTable DataKeyField="CustomerID" Caption="Customers" GridLineStyle="NotSet"> <Columns> <iswebgrid:WebGridColumn Caption="Address" DataMember="Address" Name="Address" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="City" DataMember="City" Name="City" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="CompanyName" DataMember="CompanyName" Name="CompanyName" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="ContactName" DataMember="ContactName" Name="ContactName" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="ContactTitle" DataMember="ContactTitle" Name="ContactTitle" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="Country" DataMember="Country" Name="Country" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="CustomerID" DataMember="CustomerID" Name="CustomerID" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="Fax" DataMember="Fax" Name="Fax" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="Phone" DataMember="Phone" Name="Phone" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="PostalCode" DataMember="PostalCode" Name="PostalCode" Width="100px"></iswebgrid:WebGridColumn> <iswebgrid:WebGridColumn Caption="Region" DataMember="Region" Name="Region" Width="100px"></iswebgrid:WebGridColumn> </Columns> </RootTable> </iswebgrid:webgrid> </form> </body> </HTML> using System; using System.Data; using System.Configuration; using System.Collections; using System.Collections.Generic; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using ISNet.WebUI.WebGrid; public partial class BatchUpdateDeleteRow : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { dsNorthwind.CustomersDataTable dt = new dsNorthwind.CustomersDataTable(); dsNorthwindTableAdapters.CustomersTableAdapter da = new dsNorthwindTableAdapters.CustomersTableAdapter(); da.Fill(dt); e.DataSource = dt; } /// <summary> /// Perform batch update on the Inurings WebGrid control's source /// </summary> /// <param name="source">Source to update</param> /// <returns>Updated source after batch update</returns> public void PerformInuringsGridBatchUpdate(object sender, EventArgs e) { // Get changes List<WebGridRowChanges> rowChanges = this.WebGrid1.GetChanges(); // Perform change updates foreach (WebGridRowChanges rowChangesItem in rowChanges) { if (rowChangesItem.KeyValue != null) { switch (rowChangesItem.RowState) { // Add case RowState.Added: break; // Update case RowState.Modified: break; // Delete case RowState.Deleted: break; } } } } }
If you wish to remove newly added row during batchupdate, you will need to invoke UndoChanges method. The Delete method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using GetRowState function. Here is the snippet:function DeleteRow() { var grid = ISGetObject("WebGrid1"); var selObj = grid.GetSelectedObject(); var rowObj = selObj.ToRowObject() if (rowObj.GetRowState() == "Added") rowObj.UndoChanges(); else rowObj.Delete();}
This works for me but I had to remove the Row's AddPendingChanges() method which in another post was said to be called.
Also, is there a reason why the Row's Delete method doesn't call the Row's UndoChanges() method behind the scene if the RowState is "Added"? It would save the developer from having to know this and it's not mentioned in the documentation.
I have created a feature request so the delete function will automatically called the UndoChanges method depending the state of the row.
The documentation already mention how to cancel changes in pending row during batch update in the article titled, How-to: Undo changes on specific row. This is also valid for the added pending row.
If you wish to remove newly added row during batchupdate, you will need to invoke UndoChanges method. The Delete method will not work because the newly added row has not actually added to the Grid until we accept changes. You could determine if the row is newly added or not by checking the row state using GetRowState function. Here is the snippet:function DeleteRow() { var grid = ISGetObject("WebGrid1"); var selObj = grid.GetSelectedObject(); var rowObj = selObj.ToRowObject() if (rowObj.GetRowState() == "Added") rowObj.UndoChanges(); else rowObj.Delete();}How would this work for the NewRow object in an "Unmodified" state? The Delete or UndoChanges doesn't make a difference. If a row exists, the user can click to that row basically cancelling the NewRow but I need to automate this. Also, that won't work if another row does not exist.
How would this work for the NewRow object in an "Unmodified" state? The Delete or UndoChanges doesn't make a difference. If a row exists, the user can click to that row basically cancelling the NewRow but I need to automate this. Also, that won't work if another row does not exist.
Do you mind providing a snippet / runnable sample for the NewRow object with "unmodified" state and for other condition when the UndoChanges fails when it is a newly added row?
AFAIK the row state will be updated correctly if it is a newly added row.
Do you mind providing a snippet / runnable sample for the NewRow object with "unmodified" state and for other condition when the UndoChanges fails when it is a newly added row?AFAIK the row state will be updated correctly if it is a newly added row.
Sure. I have attached the ASPX page which includes the Delete Claim function within the WebGrid's Context Menu and the underlying method that is called that is used to delete rows. In this case, the row is in an "Unmodified" state. After the Row's UndoChanges method is called, the UI just stays in the same state visually instead of disappearing as if the user clicked off the row.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreatyClaimsGrid.ascx.cs" Inherits="Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid" %> <%@ Register Assembly="ISNet.WebUI.WebDesktop" Namespace="ISNet.WebUI.WebDesktop" TagPrefix="ISWebDesktop" %> <%@ Register Assembly="ISNet.WebUI.WebGrid" Namespace="ISNet.WebUI.WebGrid" TagPrefix="ISWebGrid" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolKit" %> <script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_HASHTABLE_PATH)%>'></script> <script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_POPUPS_VALIDATEFIELDS_PATH)%>'></script> <script type="text/javascript" language="javascript" src='<%= this.Page.ResolveUrl("~" + Endurance.Re.Common.Data.CommonConstants.PAGE_JAVASCRIPT_DATE_PATH)%>'></script> <script type="text/javascript"> // --> function <%=this.ClientID%>_GetGridCtrl() { try { return WebGrid_GetGrid(<%=this.ClientID%>_GetGridClientID()); } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_GetGridClientID() { try { return "<%=this.grdTreatyClaims.ClientID%>"; } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_GetIncurredMovementClientID() { try { return "<%=this.txtIncurredMovement.ClientID%>"; } catch (ex) { ShowJSException(ex); } } function TreatyClaimsGrid_GettxtIncurredMovementCtrl() { try { return document.getElementById(<%=this.ClientID%>_GetIncurredMovementClientID()); } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_GetTotalIncurredMovement() { try { var value = ""; var field = TreatyClaimsGrid_GettxtIncurredMovementCtrl; if (field != null) { value = field.value; } return value; } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_SetViewMode(viewMode) { try { // Set View Mode var gridID = <%=this.ClientID%>_GetGridClientID(); switch(viewMode) { case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Outstanding%>": // Hide Claim related fields (Paid -> Port Out) WebGrid_ShowHideColumnByPos(gridID, 11, false); WebGrid_ShowHideColumnByPos(gridID, 12, false); WebGrid_ShowHideColumnByPos(gridID, 13, false); WebGrid_ShowHideColumnByPos(gridID, 14, false); WebGrid_ShowHideColumnByPos(gridID, 15, false); WebGrid_ShowHideColumnByPos(gridID, 16, false); WebGrid_ShowHideColumnByPos(gridID, 17, false); break; default: // Show Claim related fields (Paid -> Port Out) WebGrid_ShowHideColumnByPos(gridID, 11, true); WebGrid_ShowHideColumnByPos(gridID, 12, true); WebGrid_ShowHideColumnByPos(gridID, 13, true); WebGrid_ShowHideColumnByPos(gridID, 14, true); WebGrid_ShowHideColumnByPos(gridID, 15, true); WebGrid_ShowHideColumnByPos(gridID, 16, true); WebGrid_ShowHideColumnByPos(gridID, 17, true); break; } } catch (ex) { ShowJSException(ex); } } function grdTreatyClaims_OnInitialize(gridID) { try { // Default view <%=this.ClientID%>_SetViewMode("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GridViewMode.Default%>"); // Hide the Accept All Changes button WebGrid_ShowHideAcceptAllChangesButton(gridID, false); // Initialize row var grdTreatyClaims = ISGetObject(gridID); if (grdTreatyClaims != null) { for (var i = 0; i < grdTreatyClaims.TotalRows; i++) { var row = grdTreatyClaims.RootTable.GetRow(i); InitializeRow(row); // Calculate Incurred CalculateIncurred(<%=this.ClientID%>_GetGridClientID(), row); } } } catch (ex) { ShowJSException(ex); } } function grdTreatyClaims_OnRowContextMenu(controlID, rowType, rowElement, menuObject) { try { // Hide the Accept All Changes button var acceptAllChanges = menuObject.Items.GetNamedItem("mnuAcceptAllChanges"); if (acceptAllChanges != null) { acceptAllChanges.Hide(); } // Hide default new/delete items var menuItemList = new Array(); menuItemList.push("mnuAddNewRow"); menuItemList.push("mnuDelete"); WebGrid_ShowContextMenuItemsByList(menuObject, menuItemList, false); // Seperator var separator = new WebMenuItem(); separator.Type = "Separator"; separator.Name = "wmiSeperator1"; menuObject.Items.Add(separator); // Add Claim var newClaim = new WebMenuItem(); newClaim.ImageURL = "../..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_NEW_PATH%>"; newClaim.Text = "Create CAT Claim"; newClaim.Name = "wmiAddClaimCATClaim"; newClaim.OnClick = "AddClaimRow"; menuObject.Items.Add(newClaim); // Delete Claim // NOTE: Only allow pending claims to be deleted var rowState = WebGrid_GetSelectedRowState(<%=this.ClientID%>_GetGridClientID()); if (rowState == "Added" || rowState == "Unmodified") { var deleteClaim = new WebMenuItem(); deleteClaim.ImageURL = "../..<%=Endurance.Re.Common.Data.CommonConstants.IMAGE_DELETE_PATH%>"; deleteClaim.Text = "Delete Claim"; deleteClaim.Name = "wmiDeleteClaim"; deleteClaim.OnClick = "DeleteSelectedClaimRow"; menuObject.Items.Add(deleteClaim); } } catch (ex) { ShowJSException(ex); } } function grdTreatyClaims_OnCheckBoxClick(controlID, tblName, colName, checkboxValue, originalCheckBoxValue) { try { // Enable/Disable Outstanding field based on respective Include CheckBox control // NOTE: Reset Outstanding field if disabled and ensure all calculations are performed switch(colName) { case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>": EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", checkboxValue); break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>": EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", checkboxValue); break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>": EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", checkboxValue); break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>": EnableOutstandingField(controlID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", checkboxValue); break; } } catch (ex) { ShowJSException(ex); } } function grdTreatyClaims_OnExitEditMode(controlID, tableName, editObject) { try { if (editObject == null) { return; } // Format data // NOTE: This performs hotkey shortcuts formatControl(editObject.element, "Number"); } catch (ex) { ShowJSException(ex); } } function grdTreatyClaims_OnAfterExitEditMode(controlID, tableName, editObject) { try { // Get updated column's name if (editObject == null) { return; } var editObjectCell = editObject.ToCellObject(); if (editObjectCell == null) { return; } var colName = editObjectCell.Name; var colValue = editObjectCell.Value; switch(colName) { // Load Catastrophe Code data case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>": <%=this.ClientID%>_LoadClaimCatCode(WebGrid_GetSelectedRow(controlID)); break; // Update IncludeOutstanding field case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>": TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", colValue); break; // Update IncludeOutstanding field case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>": TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", colValue); break; // Update IncludeOutstanding field case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>": TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", colValue); break; // Update IncludeOutstanding field case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>": TreatyClaimsGrid_UpdateIncludeOutstandingField(WebGrid_GetSelectedRow(controlID), "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", colValue); break; } // Update footer column UpdateGridFooterColumn(controlID, colName); // Calculate Incurred row CalculateIncurred(controlID, editObjectCell.Row); return true; } catch (ex) { ShowJSException(ex); } } function btnCreateCATClaim_OnClientClick() { try { // Add Claim Row AddClaimRow(); } catch (ex) { ShowJSException(ex); } } function InitializeRow(row) { var returnVal = false; try { if (row == null) { return false; } // Initialize Claim Row <%=this.ClientID%>_InitializeClaimRowFields(row); returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_InitializeClaimRowFields(row) { var returnVal = false; try { // Initialize the claim data if (row == null) { return false; } var rowCells = row.GetCells(); if (rowCells == null) { return false; } // Determine if the claim is a CAT claim var isCatClaim = <%=this.ClientID%>_IsCATClaim(row); // Description var description = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>"); if (description != null) { description.SetForceNoEdit((isCatClaim == false)); } // Level 1 Cat Code var level1CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>"); if (level1CatCode != null) { level1CatCode.SetForceNoEdit((isCatClaim == false)); } // Level 3 Cat Code var level3CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>"); if (level3CatCode != null) { level3CatCode.SetForceNoEdit((isCatClaim == false)); } <%=this.ClientID%>_LoadClaimCatCode(row, false); // Cause Of Loss var causeOfLoss = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%>"); if (causeOfLoss != null) { causeOfLoss.SetForceNoEdit((isCatClaim == false)); } returnVal = true; } catch (ex) { ShowJSException(ex); } return returnVal; } function AddClaimRow() { try { // Get grid var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return false; } // Create new row var newRowElement = grid.RootTable.GetNewRow(); if (newRowElement == null) { return false; } var newRow = grid.RootTable.ToRowObject(newRowElement); if (newRow == null) { return false; } // Focus New Row grid.ClearSelection(); WebGrid_SelectRow(<%=this.ClientID%>_GetGridClientID(), newRow, "<%=Endurance.Re.FWB.Data.Constants.SP_COL_GENIUSCLAIMAMOUNT_CLAIMTITLE%>"); // Default new row's data <%=this.ClientID%>_DefaultClaimRow(newRow); newRow.SetDataChanged(); grid.MarkEdit(); return true; } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_DefaultClaimRow(row) { try { if (row == null) { return; } // Initalize the row's fields <%=this.ClientID%>_InitializeClaimRowFields(row); // Determine if CAT claim var isCatClaim = <%=this.ClientID%>_IsCATClaim(row); // Description var rowCells = row.GetCells(); var description = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>"); if (description != null) { WebGrid_SetFieldText(description, ""); } // Date Of Loss Qualififer var dateOfLossQualifier = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%>"); if (dateOfLossQualifier != null) { WebGrid_SetDropDownListValue(dateOfLossQualifier, "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>", "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"); } // Claims Made Date var claimsMadeDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"); if (claimsMadeDate != null) { var value = ""; WebGrid_SetFieldText(claimsMadeDate, value); } // Reported Date var reportedDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%>"); if (reportedDate != null) { var value = ""; if (isCatClaim == false) { value = new Date(); } WebGrid_SetFieldText(reportedDate, value); } // Event Date var eventDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%>"); if (eventDate != null) { var value = ""; if (isCatClaim == false) { value = new Date(); } WebGrid_SetFieldText(eventDate, value); } // Level 1 Cat Code var level1CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>"); if (level1CatCode != null) { var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>"; var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"; WebGrid_SetDropDownListValue(level1CatCode, text, value); } // Level 3 Cat Code var level3CatCode = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>"); if (level3CatCode != null) { var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>"; var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"; WebGrid_SetDropDownListValue(level3CatCode, text, value); } // Cause Of Loss var causeOfLoss = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CAUSEOFLOSS%>"); if (causeOfLoss != null) { var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>"; var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"; WebGrid_SetDropDownListValue(causeOfLoss, text, value); } // Misc. amount fields var fieldNameAndValueList = new Hashtable(); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>", 0); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", ""); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", ""); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", ""); fieldNameAndValueList.put("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", ""); <%=this.ClientID%>_UpdateRowClaimDataByList(<%=this.ClientID%>_GetGridClientID(), fieldNameAndValueList, row); // ID // NOTE: This is done to avoid any validation on the DataKeyField being unique var id = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_UNIQUEID%>"); if (id != null) { var now = new Date(); WebGrid_SetFieldText(id, (now.getSeconds() + now.getMilliseconds())); } } catch (ex) { ShowJSException(ex); } } function EnableOutstandingField(controlID, fieldName, enable) { var returnVal = false; try { if (IsNullOrEmpty(controlID) == true || IsNullOrEmpty(fieldName) == true) { return false; } // Get selected row var row = WebGrid_GetSelectedRow(controlID); if (row == null) { return false; } // Get outstanding field var outstanding = row.GetCell(fieldName); if (outstanding == null) { return false; } // Update outstanding field data if (enable == false) { outstanding.SetText("", true); } outstanding.SetForceNoEdit((enable == false)); TreatyClaimsGrid_UpdateField(controlID, row, outstanding, null, false); returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function TreatyClaimsGrid_SetEnabled(gridID, isEnabled) { try { // Enable/Disable TreatyClaims grid // NOTE: A div is used to prevent user input due to Intersoft WebGrid bug allowing input of a disabled grid. WebGrid_Enabled(gridID, isEnabled); $("#divTreatyClaims").css("zIndex", (isEnabled == true) ? 0 : 1); // Enable/Disabe Create Claim button var btnCreateCATClaim = ISGetObject("<%=this.btnCreateCATClaim.ClientID%>"); if (btnCreateCATClaim != null) { if (isEnabled == true) { btnCreateCATClaim.Enable(); } else { btnCreateCATClaim.Disable(); } } } catch (ex) { ShowJSException(ex); } } function UpdateGridFooterColumn(controlID, colName) { try { if (IsNullOrEmpty(controlID) == true) { return; } if (IsNullOrEmpty(colName) == true) { return; } // Get footer column's new value // NOTE: Check for Include field switch(colName) { case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>": colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>"; break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>": colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>"; break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>": colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>"; break; case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>": colName = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>"; break; } var colFooterNewValue = WebGrid_GetColumnAggregateValue(controlID, colName, null); // Update footer column if (IsNullOrEmpty(colFooterNewValue) == false) { WebGrid_SetFooterColumnValue(controlID, colName, TreatyClaimsGrid_FormatAmount(colFooterNewValue)); } } catch (ex) { ShowJSException(ex); } } function CalculateIncurred(gridID, row) { var returnVal = false; try { return true; // TODO: This method needs to be reviewed as various fields don't appear to exist on a "pending" row (NewRow) if (row == null) { return false; } var rowCells = row.GetCells(); if (rowCells == null) { return; } var paid = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>").Value); var expenses = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>").Value); var salvage = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>").Value); var indOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>").Value); var currentINDOutstanding = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INDOUTSTANDING%>").Value); var currentIND = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_IND%>").Value); var currentFEE = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_FEE%>").Value); var currentREC = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_REC%>").Value); var cashLoss = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>").Value); var refund = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>").Value); var claimPortfolioIn = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>").Value); var claimPortfolioOut = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>").Value); var currentIncurred = StripCommasFromNumeric(rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>").Value); var incurred = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED%>"); var incurredMovement = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>"); var includeOS = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>"); // Check includeOS Checkbox to determine if the O/S value should be used in incurred movement calculation if (includeOS != null && includeOS.Value == false) { indOutstanding = currentINDOutstanding; } // Enable Incurred and Movement to update value if (includeOS != null) { incurred.SetForceNoEdit(false); } if (incurredMovement != null) { incurredMovement.SetForceNoEdit(false); } var newIncurred = currentIND + currentFEE - currentREC + paid + expenses - salvage + indOutstanding + cashLoss - refund - claimPortfolioIn + claimPortfolioOut; var incurredMovementValue = newIncurred - currentIncurred; var txtIncurredMovement = TreatyClaimsGrid_GettxtIncurredMovementCtrl(); if (incurred != null) { incurred.SetText(TreatyClaimsGrid_FormatAmount(newIncurred), true); } if (incurredMovement != null) { incurredMovement.SetText(TreatyClaimsGrid_FormatAmount(incurredMovementValue), true); } // Update footer column var currentIncurred = WebGrid_GetColumnAggregateValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>", null); WebGrid_SetFooterColumnValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CURRENT_INCURRED%>", TreatyClaimsGrid_FormatAmount(currentIncurred)); // Update footer column var totalIncurredMovement = Math.abs(WebGrid_GetColumnAggregateValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>", null)); WebGrid_SetFooterColumnValue(gridID, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCURRED_MOVEMENT%>", TreatyClaimsGrid_FormatAmount(totalIncurredMovement)); if (txtIncurredMovement != null) { txtIncurredMovement.value = totalIncurredMovement; } // Disable Incurred and Movement field after updating value if (incurred != null) { incurred.SetForceNoEdit(true); } if (incurredMovement != null) { incurredMovement.SetForceNoEdit(true); } returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function TreatyClaimsGrid_UpdateClaimData(gridID, fieldName, value, forceUpdate) { try { // Field Name must be specified if (IsNullOrEmpty(fieldName) == true) { return false; } // Determine if update is allowed var allowUpdate = TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate); if (allowUpdate == false) { return false; } // Get 1st claim var row = <%=this.ClientID%>_GetFirstRow(); if (row == null) { return false; } // Update field TreatyClaimsGrid_UpdateField(gridID, row, WebGrid_GetField(row, fieldName), value); } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_UpdateClaimDataByList(gridID, fieldNameAndValueList, forceUpdate) { var returnVal = false; try { // Field Name/Value List must be specified if (fieldNameAndValueList == null || fieldNameAndValueList.isEmpty() == true) { return false; } // Determine if update is allowed var allowUpdate = TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate); if (allowUpdate == false) { return false; } // Get 1st claim var row = <%=this.ClientID%>_GetFirstRow(); if (row == null) { return false; } // Update claim data <%=this.ClientID%>_UpdateRowClaimDataByList(gridID, fieldNameAndValueList, row); } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_UpdateRowClaimDataByList(gridID, fieldNameAndValueList, row) { var returnVal = false; try { if (row == null) { return false; } var rowCells = row.GetCells(); if (rowCells == null) { return false; } for (var fieldName in fieldNameAndValueList.getList()) { // Get/Update claim's specified field var fieldToUpdate = rowCells.GetNamedItem(fieldName); if (fieldToUpdate != null) { var fieldValue = fieldNameAndValueList.get(fieldName); TreatyClaimsGrid_UpdateField(gridID, row, fieldToUpdate, fieldValue, true, false); returnVal = true; } } // Calculate Incurred data // NOTE: This should only be done after all the row updates for performance CalculateIncurred(gridID, row); } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function TreatyClaimsGrid_AllowClaimDataUpdate(gridID, forceUpdate) { try { // Update only if 1 claim exists // NOTE: Do not force update if not specified if (typeof (forceUpdate) == "undefined") { forceUpdate = false; } var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return false; } var rowCount = WebGrid_GetTotalRowCount(gridID); if (rowCount > 1 && forceUpdate == false) { return false; } } catch (ex) { ShowJSException(ex); } return true; } function TreatyClaimsGrid_UpdateField(gridID, row, field, value, updateField, calculateIncurred) { try { var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return false; } if (field == null) { return false; } if (typeof (updateField) == "undefined") { updateField = true; } if (typeof (calculateIncurred) == "undefined") { calculateIncurred = true; } // Update field data // NOTE: Force field update if not specified if (updateField == true) { var forceNoEdit = field.ForceNoEdit; if (field.ForceNoEdit == true) { field.SetForceNoEdit(false); } switch(field.Name) { // INDOutstanding // NOTE: Check/Uncheck based on if a value exists case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>": if (row != null) { TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", value); } break; // FEEOutstanding // NOTE: Check/Uncheck based on if a value exists case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>": if (row != null) { TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", value); } break; // ACROutstanding // NOTE: Check/Uncheck based on if a value exists case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>": if (row != null) { TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", value); } break; // ACEOutstanding // NOTE: Check/Uncheck based on if a value exists case "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>": if (row != null) { TreatyClaimsGrid_UpdateIncludeOutstandingField(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>", "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", value); } break; } field.SetText(TreatyClaimsGrid_FormatAmount(value), true); // Update row to force row changes if (row != null) { row.Update();} } // Update footer data UpdateGridFooterColumn(grid.Id, field.Name); // Update Incurred data if (row != null && calculateIncurred == true) { CalculateIncurred(gridID, row); } field.ForceNoEdit = forceNoEdit; } catch (ex) { ShowJSException(ex); } } function TreatyClaimsGrid_UpdateIncludeOutstandingField(row, outstandingFieldName, includeOutstandingFieldName, value) { try { if (row == null) { return; } var rowCells = row.GetCells(); if (rowCells == null) { return; } // Update Outstanding var outstandingField = rowCells.GetNamedItem(outstandingFieldName); if (outstandingField != null) { outstandingField.SetForceNoEdit((IsNullOrEmpty(value) == true)); } // Update Include Outstanding var includeOutstandingField = rowCells.GetNamedItem(includeOutstandingFieldName); if (includeOutstandingField != null) { WebGrid_SetCheckboxValue(includeOutstandingField, (IsNullOrEmpty(value) == false)); } } catch (ex) { ShowJSException(ex); } } function DeleteSelectedClaimRow(gridID) { try { // Delete WebGrid_DeleteSelectedRow(<%=this.ClientID%>_GetGridClientID()); } catch (ex) { ShowJSException(ex); } } /* Validate [START] */ function grdTreatyClaims_OnRowValidate(gridID, tableName, editObject) { try { // Validate Row return ValidateTreatyClaimsRow(WebGrid_GetSelectedRow(<%=this.ClientID%>_GetGridClientID()), true); } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_Validate(displayMsg) { var returnVal = false; try { var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return true; } // Get grid's RowChanges var rowChanges = grid.GetChanges(); if (rowChanges == null) { return true; } // Validate each row if (typeof (displayMsg) == "undefined") { displayMsg = true; } for(var index in rowChanges) { var validate = ValidateTreatyClaimsRow(rowChanges[index].Row, displayMsg); if (validate == false) { return false; } } return true; } catch (ex) { ShowJSException(ex); } } var _fieldToFocus = null; function ValidateTreatyClaimsRow(row, displayMsg) { try { // Do not validate FilterRow or Deleted rows if (row == null) { return true; } if (WebGrid_IsCurrentRowFilterRow(<%=this.ClientID%>_GetGridClientID()) == true) { return true; } if (row.GetRowState() == "Deleted") { return true; } // Determine if CAT claim var isCATClaim = <%=this.ClientID%>_IsCATClaim(row); // Get row's cells var rowCells = row.GetCells(); if (rowCells == null) { return true; } // Description var msg = new Array(); var fieldFocus = null; var descriptionText = ""; var dateOfLossQualifierValue = ""; if (isCATClaim == true) { // Required var description = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DESCRIPTION%>"); var descriptionText = (description != null) ? description.Text : null; if (IsNullOrEmpty(descriptionText) == true) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DESCRIPTION_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = description; } } } // Date Of Loss Qualifier if (isCATClaim == true) { // Required var dateOfLossQualifier = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_DATEOFLOSSQUALIFIER%>"); dateOfLossQualifierValue = (dateOfLossQualifier != null) ? dateOfLossQualifier.Value : null; if (IsNullOrEmpty(dateOfLossQualifierValue) == true || dateOfLossQualifierValue == "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>") { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_DATEOFLOSSQUALIFIER_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = dateOfLossQualifier; } } } // Claims Made Date if (isCATClaim == true) { // Required var claimsMadeDate = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"); var claimsMadeDateObj = (claimsMadeDate != null) ? parseDate(claimsMadeDate.Text) : null; if (IsNullOrEmpty(claimsMadeDateObj) == true) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; } } else { // Cannot be greater than today if (claimsMadeDateObj > new Date()) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_GREATERTHANTODAY%>"); if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; } } // Cannot be before policy's effective date var dateInception = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCEPTIONDATE%>"); var dateInceptionObj = (dateInception != null) ? parseDate(dateInception.Text) : null; if (claimsMadeDateObj < dateInceptionObj) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_CLAIMSMADEDATE_INVALID_BEFOREPOLICYEFFECTIVEDATE%>" + " (" + dateInception.Text + ")"); if (_fieldToFocus == null) { _fieldToFocus = claimsMadeDate; } } } } // Reported Date if (isCATClaim == true) { // Required var dateReported = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REPORTEDDATE%>"); var dateReportedObj = (dateReported != null) ? parseDate(dateReported.Text) : null; if (IsNullOrEmpty(dateReportedObj) == true) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = dateReported; } } else { // Cannot be greater than today if (dateReportedObj > new Date()) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_GREATERTHANTODAY%>"); if (_fieldToFocus == null) { _fieldToFocus = dateReported; } } // Cannot be before claim's made/DOL date var dateClaimsMade = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>"); var dateClaimsMadeObj = (dateClaimsMade != null) ? parseDate(dateClaimsMade.Text) : null; if (dateReportedObj < dateClaimsMadeObj) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_REPORTEDDATE_INVALID_BEFORECLAIMSMADEDATE%>" + " (" + dateClaimsMade.Text + ")"); if (_fieldToFocus == null) { _fieldToFocus = dateReported; } } } } // Event Date if (isCATClaim == true && dateOfLossQualifierValue == "<%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_DATEOFLOSSQUALIFIER_CLAIMSMADE_VALUE%>") { // Required var dateEvent = rowCells.GetNamedItem("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EVENTDATE%>"); var dateEventObj = (dateEvent != null) ? parseDate(dateEvent.Text) : null; if (IsNullOrEmpty(dateEventObj) == true) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_REQUIRED%>"); if (_fieldToFocus == null) { _fieldToFocus = dateEvent; } } else { // Cannot be greater than today if (dateEventObj > new Date()) { msg.push("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_EVENTDATE_INVALID_GREATERTHANTODAY%>"); if (_fieldToFocus == null) { _fieldToFocus = dateEvent; } } } } // Display validation message // NOTE: Add Description to caption if specified if (msg != null && msg.length > 0) { // Display // NOTE: Select row after display if (displayMsg == true) { var caption = "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.MESSAGE_VALIDATION_FAILED%>"; if (IsNullOrEmpty(descriptionText) == false) { caption += " - Description: " + descriptionText; } WebDialogBox_ShowDialog(caption, Array_GetList(msg, "<%=Endurance.Re.Common.Utility.Constants.HTML_LINEBREAK%>"), "OK", <%=this.ClientID%>_FocusRow); } return false; } return true; } catch (ex) { ShowJSException(ex); } } function <%=this.ClientID%>_IsAmountExist() { try { // Check if an amount is specified var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return false; } // Get grid's RowChanges debugger; var rowChanges = grid.GetChanges(); if (rowChanges == null || rowChanges.length == 0) { return true; } // Validate each row for(var index in rowChanges) { var row = rowChanges[index].Row; if (row != null) { var rowCells = row.GetCells(); if (rowCells != null) { // Paid if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_PAID%>") == true) { return true; } // Expenses if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_EXPENSES%>") == true) { return true; } // Salvage if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_SALVAGE%>") == true) { return true; } // Cash Loss if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CASHLOSS%>") == true) { return true; } // Refund if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_REFUND%>") == true) { return true; } // Claim Portfolio In if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOIN%>") == true) { return true; } // Claim Portfolio Out if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMPORTFOLIOOUT%>") == true) { return true; } // IND Outstanding if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEINDOUTSTANDING%>", rowCells) == true) { if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INDOUTSTANDING%>") == true) { return true; } } // FEE Outstanding if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEFEEOUTSTANDING%>", rowCells) == true) { if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_FEEOUTSTANDING%>") == true) { return true; } } // ACR Outstanding if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACROUTSTANDING%>", rowCells) == true) { if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACROUTSTANDING%>") == true) { return true; } } // ACE Outstanding if (WebGrid_GetCheckboxValue("<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_INCLUDEACEOUTSTANDING%>", rowCells) == true) { if (<%=this.ClientID%>_IsAmountValueExist(rowCells, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_ACEOUTSTANDING%>") == true) { return true; } } } } } } catch (ex) { ShowJSException(ex); returnVal = false;} return false; } function <%=this.ClientID%>_IsAmountValueExist(rowCells, fieldName) { var returnVal = false; try { // Check if the Amount value exist if (rowCells == null || IsNullOrEmpty(fieldName) == true) { return false; } var field = rowCells.GetNamedItem(fieldName); if (field == null) { return false; } returnVal = (StripCommasFromNumeric(field.Value) > 0); } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_IsOutstandingChecked(rowCells, fieldName) { var returnVal = false; try { // Check if the Amount value exist if (rowCells == null || IsNullOrEmpty(fieldName) == true) { return false; } var field = rowCells.GetNamedItem(fieldName); if (field == null) { return false; } returnVal = (StripCommasFromNumeric(field.Value) > 0); } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_FocusRow() { var returnVal = false; try { // Select row // NOTE: This is done after the WebDialog is displayed to ensure row focus is not lost if (_fieldToFocus == null) { return; } WebGrid_SelectRow(<%=this.ClientID%>_GetGridClientID(), _fieldToFocus.Row, _fieldToFocus.Name); _fieldToFocus = null; returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } /* Validate [END] */ function <%=this.ClientID%>_LoadClaimCatCode(row, defaultList) { var returnVal = false; try { // Load Catastrophe Code data for CAT Claims only if (row == null) { return false; } if (<%=this.ClientID%>_IsCATClaim(row) == false) { return false; } // Get DOL var claimsMadeDateObj = parseDate(WebGrid_GetFieldValue(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_CLAIMSMADEDATE%>")); // Load Claim's Level 1 and Level 3 Catastrophe Code data if (typeof(defaultList) == "undefined") { defaultList = true; } <%=this.ClientID%>_LoadClaimCatCodeControl(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>", claimsMadeDateObj, _GeniusClaimLevel1CatCode, defaultList); <%=this.ClientID%>_LoadClaimCatCodeControl(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL3CATCODE%>", claimsMadeDateObj, _GeniusClaimLevel3CatCode, defaultList); returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_LoadClaimCatCodeControl(row, catCodeFieldName, dateOfLoss, geniusClaimCatCode, defaultList) { var returnVal = false; try { // Load the Cat Code data // NOTE: Clear items but Select if (IsNullOrEmpty(catCodeFieldName) == true) { return false; } if (typeof(geniusClaimCatCode) == "undefined" || geniusClaimCatCode == null || geniusClaimCatCode.length == 0) { return false; } var $dropdownList = $("#" + <%=this.ClientID%>_GetGridClientID() + "__" + catCodeFieldName); if ($dropdownList == null) { return false; } $("option:not(:first)", $dropdownList).remove(); var dropdownListDOM = $dropdownList.get(0); if (dropdownListDOM == null) { return false; } $.each(geniusClaimCatCode, function(val, item) { if (JSON_ToDate(item.CatastropheDateOfLossFrom) <= dateOfLoss && JSON_ToDate(item.CatastropheDateOfLossTo) >= dateOfLoss) { dropdownListDOM.options.add(new Option(item.CatastropheShortName, item.CatastropheCode)); } }); // Default Select if (defaultList == true) { if (row == null) { return false; } var rowCells = row.GetCells(); if (rowCells == null) { return false; } var catCodeField = rowCells.GetNamedItem(catCodeFieldName); if (catCodeField != null) { var text = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_VALUE%>"; var value = "<%=Endurance.Re.Common.Data.CommonConstants.NAMEVALUEOBJECT_SELECT_ID%>"; WebGrid_SetDropDownListValue(catCodeField, text, value); } } returnVal = true; } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_IsCATClaim(row) { var returnVal = false; try { // Determine if the claim is a Catastrophe claim if (row == null) { return false; } var level1CatValue = WebGrid_GetFieldValue(row, "<%=Endurance.Re.FWB.Web.FWBWebControls.Treaty.TreatyClaimsGrid.GRID_COL_LEVEL1CATCODE%>"); returnVal = (level1CatValue != "<%=Endurance.Re.FWB.Data.Constants.GENIUS_CLAIM_TYPE_BLOCK_VALUE%>"); } catch (ex) { ShowJSException(ex); returnVal = false; } return returnVal; } function <%=this.ClientID%>_GetFirstRow() { var row = null; try { // Get 1st claim var grid = <%=this.ClientID%>_GetGridCtrl(); if (grid == null) { return null; } var row = grid.RootTable.GetRow(0); } catch (ex) { ShowJSException(ex); } return row; } // Function to add formatting (eg "," etc) to supplied number value function TreatyClaimsGrid_FormatAmount(number) { try { var num = new NumberFormat(); num.setInputDecimal("."); num.setPlaces("2"); num.setNegativeFormat(num.LEFT_DASH); num.setCommas(true); var result = number; num.setNumber(result); result = num.toFormatted(); return result; } catch (ex) { ShowJSException(ex); } } // --> </script> <table style="table-layout:fixed;width:100%;height:100%"> <tr> <td> <ISWebDesktop:WebButton runat="server" ID="btnCreateCATClaim" DisplayMode="TextAndImage" Text="Create CAT Claim" Image="~/Images/16x16/wg5_newrow.gif" ToolTip="Create a Catastrophe claim" ImagePosition="Left" Height="20px" Width="125px" AutoPostback="false" OnClientClick="javascript:btnCreateCATClaim_OnClientClick()" /> </td> </tr> <tr> <td> <div class="ContentTemplateGridContent"> <div id="divTreatyClaims" style="width:100%;height:100%;position:absolute;margin:0px; padding: 0px; background-color: #dcdcdc; filter: alpha(opacity=50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.5"> </div> <asp:TextBox runat="server" ID="txtIncurredMovement" CssClass="HideControl" /> <CommonCtrl:EnduranceWebGrid runat="server" ID="grdTreatyClaims" DefaultStyleMode="Elegant" Height="100%" Width="100%" UseDefaultStyle="True" EnableViewState="false" ViewStateStorage="None" OnInitializeDataSource="grdTreatyClaims_OnInitializeDataSource" OnInitializeLayout="grdTreatyClaims_OnInitializeLayout" OnInitializePostBack="grdTreatyClaims_OnInitializePostBack" OnPrepareDataBinding="grdTreatyClaims_OnPrepareDataBinding" OnExport="grdTreatyClaims_OnExport" OnBatchUpdate="grdTreatyClaims_OnBatchUpdate" OnInitializeRow="grdTreatyClaims_OnInitializeRow"> <LayoutSettings AllowBatchUpdate="true" BatchUpdateSettings-PromptUnsavedChanges="false" NewRowLostFocusAction="AlwaysUpdate" AllowAddNew="Yes" AllowEdit="Yes" AllowDelete="Yes" EditOnClick="True" AutoHeight="false" RowHeightDefault="22px" AutoWidth="false" AllowColumnFreezing="Yes" AllowExport="No" AllowFilter="No" AllowSelectColumns="Yes" AllowSorting="No" AlwaysShowHelpButton="False" ApplyFiltersKey="Enter" CellPaddingDefault="0" FilterBarVisible="True" HideColumnsWhenGrouped="Default" InProgressUIBehavior="ChangeCursorToHourGlass" PagingExportMode="ExportAllData" PagingMode="VirtualLoad" ResetNewRowValuesOnError="False" ShowFilterStatus="True" VerboseEditingInformation="False" VirtualPageSize="200"> <ClientSideEvents OnInitialize="grdTreatyClaims_OnInitialize" OnRowContextMenu="grdTreatyClaims_OnRowContextMenu" OnCheckBoxClick="grdTreatyClaims_OnCheckBoxClick" OnExitEditMode="grdTreatyClaims_OnExitEditMode" OnAfterExitEditMode="grdTreatyClaims_OnAfterExitEditMode" OnRowValidate="grdTreatyClaims_OnRowValidate" /> <FrameStyle> <BorderSettings> <Top Style="none" /> <Bottom Style="none" /> <Left Color="#6593cf" Style="solid" Width="1" /> <Right Color="#6593cf" Style="solid" Width="1" /> </BorderSettings> </FrameStyle> <HeaderStyle CssClass="WebGridHeaderStyle" /> <StatusBarStyle CssClass="WebGridStatusBarStyle" /> <StatusBarCommandStyle Active-CssClass="WebGridStatusBarCommandStyleActive" Normal-CssClass="WebGridStatusBarCommandStyleNormal" Over-CssClass="WebGridStatusBarCommandStyleOver"> <Normal CssClass="WebGridStatusBarCommandStyleNormal" /> <Over CssClass="WebGridStatusBarCommandStyleOver" /> <Active CssClass="WebGridStatusBarCommandStyleActive" /> </StatusBarCommandStyle> <FilterRowStyle CssClass="WebGridFilterRowStyle" /> <PreviewRowStyle CssClass="WebGridRowStyle" /> <RowStyle CssClass="WebGridRowStyle" /> <QuickFilterBarStyle CssClass="WebGridRowStyle" /> <RowHeaderStyle CssClass="WebGridRowHeaderStyle" /> <SelectedRowStyle CssClass="WebGridSelectedRowStyle" /> <EditFocusCellStyle CssClass="WebGridRowStyle" /> <FocusCellStyle CssClass="WebGridRowStyle" /> <LostFocusRowStyle CssClass="WebGridRowStyle" /> <NewRowStyle CssClass="WebGridRowStyle" /> <SortedColumnStyle CssClass="WebGridSortedColumnStyle" /> <AlternatingRowStyle CssClass="WebGridAlternatingRowStyle" /> <EditTextboxStyle CssClass="WebGridEditTextboxStyle" /> <FreezePaneSettings AbsoluteScrolling="True" ActiveFrozenColumns="3" MaxFrozenColumns="3" ShowInContextMenu="False" ShowSplitterLine="False" SplitterLineColor="ActiveBorder" SplitterLineWidth="1" /> </LayoutSettings> <RootTable Caption="Claims Transaction" DataKeyField="UniqueID" ColumnFooters="Yes"> <Columns> <ISWebGrid:WebGridColumn Caption="UniqueID" Name="UniqueID" DataType="System.Integer" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit" Width="0px" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="InceptionDate" Name="InceptionDate" DataMember="InceptionDate" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="NoEdit" NewRowEditType="NoEdit" FilterEditType="NoEdit" Width="0px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Claim Number" Name="ClaimMasterReference" DataMember="ClaimMasterReference" DataType="System.String" EditType="NoEdit" FilterEditType="TextBox" Width="150px" FooterText="Total"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Description" Name="ClaimTitle" DataMember="ClaimTitle" DataType="System.String" EditType="TextBox" FilterEditType="TextBox" Width="275px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Date of Loss Qualifier" Name="DateOfLossQualifier" DataMember="DateOfLossQualifier" DataType="System.Integer" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="125px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Claims Made Date/Date of Loss" Name="ClaimDateOfLossFrom" DataMember="ClaimDateOfLossFrom" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo" NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="175px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Reported Date" Name="ClaimAdvisedDate" DataMember="ClaimAdvisedDate" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo" NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Event Date" Name="DateOfEvent" DataMember="DateOfEvent" DataFormatString="dd-MMM-yyyy" DataType="System.String" ColumnType="Text" EditType="CalendarCombo" NewRowEditType="CalendarCombo" FilterEditType="CalendarCombo" Width="90px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Level 1 Cat" Name="ClaimLevel1CATCode" DataMember="ClaimLevel1CATCode" DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Level 3 Cat" Name="ClaimLevel3CATCode" DataMember="ClaimLevel3CATCode" DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="100px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Cause of Loss" Name="LossAnalysis1Code" DataMember="LossAnalysis1Code" DataType="System.String" ColumnType="Custom" EditType="DropdownList" NewRowEditType="DropdownList" FilterEditType="DropdownList" Width="120px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Paid" Name="Paid" DataMember="Paid" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Expenses" Name="Expenses" DataMember="Expenses" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Salvage" Name="Salvage" DataMember="Salvage" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Cash Loss" Name="CashLoss" DataMember="CashLoss" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Refund" Name="Refund" DataMember="Refund" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Port In" Name="ClaimPortfolioIn" DataMember="ClaimPortfolioIn" DataFormatString="#,##0.00" DefaultValue="0" DataType="System.Decimal" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Port Out" Name="ClaimPortfolioOut" DataMember="ClaimPortfolioOut" DataFormatString="#,##0.00" DefaultValue="0" DataType="System.Decimal" EditType="TextBox" FilterEditType="TextBox" Width="80px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current Indemnity O/S" Name="CurrentINDOutstanding" DataMember="CurrentINDOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="NoEdit" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption=" " Name="IncludeINDOutstanding" DataMember="IncludeINDOutstanding" ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="New Indemnity O/S" Name="INDOutstanding" DataMember="INDOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current Fee O/S" Name="CurrentFEEOutstanding" DataMember="CurrentFEEOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="NoEdit" FilterEditType="NoEdit" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption=" " Name="IncludeFEEOutstanding" DataMember="IncludeFEEOutstanding" ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="New Fee O/S" Name="FEEOutstanding" DataMember="FEEOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current ACR O/S" Name="CurrentACROutstanding" DataMember="CurrentACROutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption=" " Name="IncludeACROutstanding" DataMember="IncludeACROutstanding" ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="New ACR O/S" Name="ACROutstanding" DataMember="ACROutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="ACE O/S" Name="CurrentACEOutstanding" DataMember="CurrentACEOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption=" " Name="IncludeACEOutstanding" DataMember="IncludeACEOutstanding" ColumnType="CheckBox" EditType="Checkbox" FilterEditType="NoEdit" Width="25px"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="New ACE O/S" Name="ACEOutstanding" DataMember="ACEOutstanding" DataFormatString="#,##0.00" DataType="System.Decimal" DefaultValue="0" EditType="TextBox" FilterEditType="TextBox" Width="130px" AggregateFunction="Sum"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current IND" Name="CurrentIND" DataMember="CurrentIND" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current FEE" Name="CurrentFEE" DataMember="CurrentFEE" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current REC" Name="CurrentREC" DataMember="CurrentREC" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Current Incurred" Name="CurrentIncurred" DataMember="CurrentIncurred" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="NoEdit" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Incurred" Name="Incurred" DataMember="" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> <ISWebGrid:WebGridColumn Caption="Movement" Name="IncurredMovement" DataMember="" DefaultValue="0" DataFormatString="#,##0.00" DataType="System.Decimal" EditType="TextBox" FilterEditType="NoEdit" AggregateFunction="Sum" Visible="false"> </ISWebGrid:WebGridColumn> </Columns> </RootTable> </CommonCtrl:EnduranceWebGrid> </div> </td> </tr> </table> function WebGrid_DeleteSelectedRow(gridID) { try { // Delete selected row // NOTE: Use UndoChanges for rows that were added and now deleted as RowState won't change to Deleted if the Delete method is used // Hide the deleted row for Intersoft's BatchUpdate var row = WebGrid_GetSelectedRow(gridID); if (row == null) { return; } var rowState = row.GetRowState(); if (rowState.toUpperCase() == "ADDED") { row.UndoChanges(); WebGrid_HideRow(row); } else if (rowState.toUpperCase() == "UNMODIFIED") { window.alert("UNMODIFIED"); row.UndoChanges(); } else { row.Delete(); WebGrid_HideRow(row); } } catch (ex) { ShowJSException(ex); } }
Based on my test in a simple sample using the delete snippet in you code, I could not have a NewRow object which has Unmodified state. Could you explain the steps to replicate the issue in the attached sample?
The sample requires Northwind database which has already provided in the WebGrid sample.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname