|
Rank: Member Groups: Member
Joined: 10/4/2008 Posts: 28
|
Hi,
I have 2 grids on the same page. One grid works perfectly but the other does not register added or changed items, but it does register deleted items. I have added the grid definition below. What could cause this behavior?
<eo:Grid ID="PayRateGrid" runat="server" BorderColor="Black" BorderWidth="0px" ColumnHeaderAscImage="00050403" ColumnHeaderDescImage="00050404" EnableKeyboardNavigation=true ClientSideOnCellSelected="on_payrategrid_cell_selected" ClientSideOnItemCommand="OnItemDelete" ColumnHeaderDividerImage="00050402" ColumnHeaderDividerOffset="6" ColumnHeaderHeight="18" FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Verdana" Font-Overline="False" Font-Size="9pt" Font-Strikeout="False" Font-Underline="False" GridLineColor="240, 240, 240" GridLines="Both" Height="400px" ItemHeight="18" Width="100%" FullRowMode="False" AllowNewItem="True" PageSize="40"> <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" /> <ItemStyles> <eo:GridItemStyleSet StyleSetID="Error"> <ItemStyle CssText="background-color: red" /> <CellStyle CssText="color:#black;white-space:nowrap;" /> </eo:GridItemStyleSet> <eo:GridItemStyleSet StyleSetID="Normal"> <ItemStyle CssText="background-color: white" /> <SelectedStyle CssText="background-color: white" /> <CellStyle CssText="color:#black;white-space:nowrap;" /> </eo:GridItemStyleSet> </ItemStyles> <ColumnTemplates> <eo:TextBoxColumn> <TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" /> </eo:TextBoxColumn> <eo:MaskedEditColumn> <MaskedEdit ControlSkinID="None" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;"> </MaskedEdit> </eo:MaskedEditColumn> </ColumnTemplates> <Columns> <eo:ButtonColumn Width="20" ButtonText="X" CommandName="Delete"><CellStyle CssClass="eoDeleteButton" /></eo:ButtonColumn> <eo:RowNumberColumn Width="50" HeaderText="Row" > <CellStyle CssText="background-color:#cccccc;" /> </eo:RowNumberColumn> <eo:CustomColumn Width="210" ClientSideBeginEdit="on_begin_edit_client" ClientSideEndEdit ="on_end_edit_client" DataField="Name" HeaderText="Client" Name="ddClient" AllowSort="true"> <EditorTemplate> <select id="ddClient" > <option>-Please Select-</option> <asp:Repeater Runat="server" ID="Clients"> <ItemTemplate> <option><%#DataBinder.Eval(Container.DataItem, "Name")%> </ItemTemplate> </asp:Repeater> </select> </EditorTemplate> </eo:CustomColumn> <eo:CustomColumn Width="90" ClientSideBeginEdit="on_begin_edit_groupsize" ClientSideEndEdit ="on_end_edit_groupsize" DataField="GroupSize" HeaderText="Group Size" Name="ddGroupSize" AllowSort="true"> <EditorTemplate> <select id="ddGroupSize" onchange ="on_servicetype_change()" > <option>-Please Select-</option> <asp:Repeater Runat="server" ID="GroupSizes"> <ItemTemplate> <option><%#DataBinder.Eval(Container.DataItem, "GroupSize")%> </ItemTemplate> </asp:Repeater> </select> </EditorTemplate> </eo:CustomColumn> <eo:DateTimeColumn Width="140" Name="EffectiveBeginDate" DataField="EffectiveBeginDate" HeaderText="Effective Begin Date" AllowSort="true" ></eo:DateTimeColumn> <eo:DateTimeColumn Width="130" Name="EffectiveEndDate" DataField="EffectiveEndDate" HeaderText="Effective End Date"></eo:DateTimeColumn> <eo:CustomColumn Width="200" ClientSideBeginEdit="on_begin_edit_servicetype" ClientSideEndEdit ="on_end_edit_servicetype" DataField="ServiceType" HeaderText="Service Type" Name="ddServiceType" AllowSort="true"> <EditorTemplate> <select id="ddServiceType" onchange ="on_servicetype_change()"> <option>-Please Select-</option> <asp:Repeater Runat="server" ID="ServiceTypes"> <ItemTemplate> <option><%#DataBinder.Eval(Container.DataItem, "ServiceType")%> </ItemTemplate> </asp:Repeater> </select> </EditorTemplate> </eo:CustomColumn>
<eo:TextBoxColumn Width="100" Name="StaffActualPayRate" DataField="StaffActualPayRate" HeaderText="Actual Pay Rate" AllowSort="true"></eo:TextBoxColumn>
</Columns> <ColumnHeaderStyle CssText="background-image:url('00050401');padding-left:8px;padding-top:2px;" /> </eo:Grid>
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The most likely cause is the JavaScript hanlders you supplied to the CustomColumns throw out an exception when called by the Grid. Try to remove all CustomColumns and see if it works. If that works, you can try to put them back one by one and that should help you find out which one caused the problem. You can also enable JavaScript debugging on your browser and that maybe able to tell you what went wrong.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 10/4/2008 Posts: 28
|
The problem seems to be the call to on_servicetype_change() which raises a server side event to populate the last column based on the dropdown selection. If that call is made the grid no longer has any added or deleted items. How can I solve this?
function on_servicetype_change() { if (g_curItemIndex >= 0) { var grid = eo_GetObject("PayRateGrid"); //Raises the server side ItemCommand event. The second //parameter is not used in this sample. If you have //multiple columns that call this function, you can use //this second parameter to distinguish the columns. It //can also be used to distinguish multiple actions //from the same column grid.raiseItemCommandEvent(g_curItemIndex, "SelectServiceType"); } }
|
|
Rank: Member Groups: Member
Joined: 10/4/2008 Posts: 28
|
correction: the grid has no added or changed items
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That probably won't work. When user adds a new row to the Grid, the Grid first adds a temporary row and then put that row/cell into edit mode. The row is only submitted after user has moved away to another cell or row. The same apply when user edits a cell. The change will not be submitted before user leaves that cell.
In your case, it appears that you post back the page directly before user leaves the cell. In order for it to work for you, you must leave the cell first. You can do this by calling editItem(-1)/editCell(-1) to exit the edit mode first, then call raiseItemCommandEvent to post back the page. You may need to put both into a separate function, then call it with a setTimeout so that your on_servicetype_change completes first before editItem(-1) kicks in.
Thanks
|
|