May 05, 2014, 2:19 PM
[CLOSED] GridPanel with rowselection, checkbox not displaying checked.
Hi guys,
I am having an issue here and I can't seem to figure it out. I have a GridPanel in which I can choose a row (RowSelection) and it updates a form (viewer form). For some reason all my fields are updated except for my 2 check box. Maybe I am going at this in a wrong way. Maybe you can help me out. Here's my code:
Note: I simplified my code as best as I could.
Bert
I am having an issue here and I can't seem to figure it out. I have a GridPanel in which I can choose a row (RowSelection) and it updates a form (viewer form). For some reason all my fields are updated except for my 2 check box. Maybe I am going at this in a wrong way. Maybe you can help me out. Here's my code:
Note: I simplified my code as best as I could.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="test.aspx.vb" Inherits="uohms.test" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>UOHMS</title>
<link href="./resources/css/xtheme-olive.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var customDate = function (value) {
if (value == 'Tue Jan 1 00:00:00 EST 1901') {
return '';
} else {
return Ext.util.Format.date(value, 'd/m/Y');
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ScriptManager" runat="server" />
<asp:ObjectDataSource ID="dsRateType" runat="server" SelectMethod="FindAll"
TypeName="UOttawa.BusinessObjects.RateTypeCollection"
OldValuesParameterFormatString="original_{0}" >
</asp:ObjectDataSource>
<ext:Store ID="stoRateType" runat="server" DataSourceID="dsRateType">
<Reader>
<ext:JsonReader IDProperty="RateCode">
<Fields>
<ext:RecordField Name="RateCode" />
<ext:RecordField Name="FormCode" />
<ext:RecordField Name="StartDate" Type="Date" />
<ext:RecordField Name="EndDate" Type="Date" />
<ext:RecordField Name="EnglishDescription" />
<ext:RecordField Name="RateManual" />
<ext:RecordField Name="AccrueSenPoints" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:Panel
ID="pnlRateType"
runat="server"
Title="Rate Type"
Width="1000"
BodyStyle="padding:10px;"
ButtonAlign="Center">
<Items>
<ext:Container ID="Container1" runat="server" Layout="ColumnLayout" Height="600">
<Items>
<ext:GridPanel runat="server" ID="grdRateType" Title="Viewer" Frame="true"
StoreID="stoRateType" Height="450" Width="470">
<ColumnModel ID="clmRateType" runat="server">
<Columns>
<ext:Column ColumnID="RateCode" Header="Rate Code" Width="45" DataIndex="RateCode" />
<ext:Column ColumnID="FormCode" Header="Form" Width="25" DataIndex="FormCode" />
<ext:Column DataIndex="EnglishDescription" Header="Description" Width="220" />
<ext:Column DataIndex="StartDate" Header="Effective" Width="75">
<Renderer Fn="customDate" />
</ext:Column>
<ext:Column DataIndex="EndDate" Header="Expires" Width="75">
<Renderer Fn="customDate" />
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="rsmRateType" runat="server" SingleSelect="true">
<DirectEvents>
<RowSelect OnEvent="RowSelect" Buffer="250">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="#{pnlEditor}" />
<ExtraParams>
<%-- or can use params[2].id as value --%>
<ext:Parameter Name="RowID" Value="this.getSelected().id" Mode="Raw" />
<ext:Parameter Name="RateCode" Value="this.getSelected().data.RateCode" Mode="Raw" />
<ext:Parameter Name="FormCode" Value="this.getSelected().data.FormCode" Mode="Raw" />
<ext:Parameter Name="StartDate" Value="this.getSelected().data.StartDate" Mode="Raw" />
<ext:Parameter Name="EndDate" Value="this.getSelected().data.EndDate" Mode="Raw" />
<ext:Parameter Name="EnglishDescription" Value="this.getSelected().data.EnglishDescription" Mode="Raw" />
<ext:Parameter Name="RateManual" Value="this.getSelected().data.RateManual" Mode="Raw" />
<ext:Parameter Name="AccrueSenPoints" Value="this.getSelected().data.AccrueSenPoints" Mode="Raw" />
</ExtraParams>
</RowSelect>
</DirectEvents>
</ext:RowSelectionModel>
</SelectionModel>
<BottomBar>
<ext:PagingToolBar ID="ptbRateTypes" runat="server"
PageSize="20"
DisplayInfo="true"
DisplayMsg="Displaying rate types {0} - {1} of {2}"
EmptyMsg="No rate types to display"
/>
</BottomBar>
</ext:GridPanel>
<ext:Panel
ID="pnlEditor"
runat="server"
Frame="true"
Title="Editor"
Width="500">
<Items>
<ext:Container ID="Container2" runat="server" LabelAlign="Left" Layout="FormLayout" LabelWidth="100">
<Items>
<ext:TextField
ID="txtRateCode"
runat="server"
FieldLabel="Rate Code"
Width="50"
StyleSpec="background:#E5E5E5;"
ReadOnly="true"
/>
<ext:RadioGroup ID="rdoFormCode" runat="server" HideLabel="false" FieldLabel="Form Code" AutoWidth="true">
<Items>
<ext:RadioColumn ID="rcolCupe" runat="server" ColumnWidth="0.25">
<Items>
<ext:Radio ID="optCupe" runat="server" BoxLabel="CUPE" />
</Items>
</ext:RadioColumn>
<ext:RadioColumn ID="rcolAptpuo" runat="server" ColumnWidth="0.4">
<Items>
<ext:Radio ID="optAptpuo" runat="server" BoxLabel="APTPUO" />
</Items>
</ext:RadioColumn>
</Items>
</ext:RadioGroup>
<ext:Panel ID="pnlSpacer1" runat="server" Html="<br />" />
<ext:DateField
runat="server"
ID="txtStartDate"
Width="100"
Vtype="daterange"
Format="dd/MM/yyyy"
AltFormats="dd-MM-yyyy|d-M-yy|d-M-yyyy|yyyy-MM-dd|yyyy-M-d"
FieldLabel="Effective">
<Listeners>
<Render Handler="this.endDateField = '#{txtEndDate}'" />
</Listeners>
</ext:DateField>
<ext:DateField
runat="server"
ID="txtEndDate"
Width="100"
Vtype="daterange"
Format="dd/MM/yyyy"
AltFormats="dd-MM-yyyy|d-M-yy|d-M-yyyy|yyyy-MM-dd|yyyy-M-d"
FieldLabel="Expires">
<Listeners>
<Render Handler="this.startDateField = '#{txtStartDate}'" />
</Listeners>
</ext:DateField>
<ext:Panel ID="pnlSpacer3" runat="server" Html="<br />" />
<ext:Checkbox ID="chkRateManual" runat="server" FieldLabel="Manual Rate? " />
<ext:Checkbox ID="chkAccrueSenPoints" runat="server" FieldLabel="Accrue Points? " />
<ext:Panel ID="pnlSpacer4" runat="server" Html="<br />" />
<ext:TextField
ID="txtEnglishDescription"
runat="server"
FieldLabel="English"
Width="350"
ReadOnly="false"
MaxLength="50"
/>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</Items>
</ext:Container>
</Items>
</ext:Panel>
</form>
</body>
</html>
Code Behind:Imports Ext.Net
Imports UOttawa.BusinessObjects
Partial Public Class Test
Inherits SecurityPage
Protected Overloads Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not FollowMe.IsAllowed(SecurityRole.HrView) Then
Response.Redirect(FollowMe.AccessDeniedURL)
End If
End Sub
Protected Sub RowSelect(ByVal sender As Object, ByVal e As DirectEventArgs)
Dim _strRowID As String = e.ExtraParams("RowID")
LoadItem(e.ExtraParams("RateCode"))
End Sub
Protected Sub LoadItem(ByVal RateCode As String)
Dim _col As RateTypeCollection = New RateTypeCollection()
Dim item As RateType = _col.FindByID(RateCode)
Me.txtRateCode.Text = item.RateCode
If item.FormCode = "C" Then
optCupe.Value = True
optAptpuo.Value = False
ElseIf item.FormCode = "A" Then
optCupe.Value = False
optAptpuo.Value = True
Else
optCupe.Value = False
optAptpuo.Value = False
End If
Me.txtStartDate.SelectedDate = item.StartDate
Me.txtEndDate.SelectedDate = item.EndDate
Me.txtEnglishDescription.Text = item.EnglishDescription
'Me.chkRateManual.Value = item.IsRateManual
Me.chkRateManual.Checked = item.IsRateManual
Me.chkAccrueSenPoints.Checked = item.IsAccrueSeniorityPoints
End Sub
End Class
Thanks for the help,Bert
Last edited by Daniil; May 06, 2014 at 1:48 PM.
Reason: [CLOSED]