Jun 22, 2010, 4:00 PM
[CLOSED] Editable Grid - Checkbox issue...
Hi,
I have this editable grid.
1. I want boolean values to show up as check boxes...
2. When I click to edit a boolean value, the check box shifts to the lower right corner..
Any ideas?
I have this editable grid.
1. I want boolean values to show up as check boxes...
2. When I click to edit a boolean value, the check box shifts to the lower right corner..
Any ideas?
<title>Snippet</title><%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserAlerts.aspx.cs" Inherits="UserAlerts" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<ext:XScript runat="server">
<script>
var startEditing = function (e) {
if (e.getKey() === e.ENTER) {
var grid = #{GridPanel1},
record = grid.getSelectionModel().getSelected(),
index = grid.store.indexOf(record);
grid.startEditing(index, 1);
}
};
var afterEdit = function (e) {
try {
if (addClicked)
{
// #{DirectMethods}.AddJournal(-1,e.record.data.Message,e.record.data.CreatedBy,e.record.data.DateOfMessage);
// addClicked=false;
// Ext.net.Notification.show({hideFx:{args:[{}],fxName:'switchOff'},showFx:{args:['C3DAF9',1,{duration:1.0}],fxName:'frame'},pinEvent:'click',alignToCfg:{offset:[-60,20],position:'tr-tr'},html:'You have successfully added this journal entry.',title:'Successfull Save'});
}
else
{
// #{DirectMethods}.AfterJournalEdit(e.record.data.JournalId,e.field, e.value );
// Ext.net.Notification.show({hideFx:{args:[{}],fxName:'switchOff'},showFx:{args:['C3DAF9',1,{duration:1.0}],fxName:'frame'},pinEvent:'click',alignToCfg:{offset:[-60,20],position:'tr-tr'},html:'You have successfully edit this journal entry.',title:'Successfull Edit'});
}
}
catch (e) {
// alert(e);
}
};
</script>
</ext:XScript>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if ( !X.IsAjaxRequest )
{
this.BindData();
}
}
protected void MyData_Refresh(object sender, StoreRefreshDataEventArgs e)
{
this.BindData();
}
private void BindData()
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
}
private object[] Data
{
get
{
DateTime now = DateTime.Now;
return new object[]
{
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53", 1,3, "Fund1",100,"Aksia Report",2, "Add",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",1,3, "Fund1",100,"Aksia Report",3, "Update",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",1,3, "Fund1",300,"Note",2, "Add",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",12,3, "Fund12",100,"Aksia Report",2, "Add",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",12,3, "Fund12",300,"Note",2, "Add",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",12,3, "Fund12",300,"Note",3, "Update",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",12,4, "Portfolio1",100,"Aksia Report",2, "Add",2,"Daily",0,1},
new object[] {"3e94095c-60f2-4265-9b48-6ce47133bd53",12,4, "Portfolio1",300,"Note",2, "Add",2,"Daily",0,1},
};
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:GridPanel ID="GridPanel1" runat="server" Height="600" Width="600" Title="Documents"
AutoExpandColumn="entityname">
<Store>
<ext:Store runat="server" ID="Store1" GroupField="entityname">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="userId" Type="String" />
<ext:RecordField Name="entityId" Type="Int" />
<ext:RecordField Name="entityTypeId" Type="Int" />
<ext:RecordField Name="entityname" Type="String" />
<ext:RecordField Name="alertentitytypeid" Type="Int" />
<ext:RecordField Name="alertname" Type="String" />
<ext:RecordField Name="auditactiontypeid" Type="Int" />
<ext:RecordField Name="name" Type="String" />
<ext:RecordField Name="frequencyid" Type="Int" />
<ext:RecordField Name="frequencyname" Type="String" />
<ext:RecordField Name="issuspended" Type="Boolean" />
<ext:RecordField Name="sendemailnotifcation" Type="Boolean" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<Listeners>
<KeyDown Fn="startEditing" />
<AfterEdit Fn="afterEdit" />
</Listeners>
<TopBar>
<ext:Toolbar runat="server" ID="tbDocs">
<Items>
<ext:Button runat="server" ID="btnSuspend" />
</Items>
</ext:Toolbar>
</TopBar>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="entityname" Header="Entity" Width="75" DataIndex="entityname"
Align="Center" />
<ext:Column ColumnID="alertname" Header="Alert Type" Width="75" DataIndex="alertname"
Align="Center" />
<ext:Column ColumnID="name" Header="Action" Width="75" DataIndex="name" Align="Center" />
<ext:Column ColumnID="frequencyname" Header="Frequency" Width="75" DataIndex="frequencyname"
Align="Center">
<Editor>
<ext:ComboBox runat="server" ID="cmbFreq">
<Items>
<ext:ListItem Value="1" Text="Hourly" />
<ext:ListItem Value="2" Text="Daily" />
<ext:ListItem Value="3" Text="Weekly" />
<ext:ListItem Value="7" Text="Immediate" />
</Items>
</ext:ComboBox>
</Editor>
</ext:Column>
<ext:BooleanColumn ColumnID="issuspended" Header="Is Suspended" Width="75" DataIndex="issuspended"
Align="Center">
<Editor>
<ext:Checkbox runat="server" ID="chkSus"></ext:Checkbox>
</Editor>
</ext:BooleanColumn>
<ext:BooleanColumn ColumnID="sendemailnotifcation" Header="Email Notification" Width="80"
DataIndex="sendemailnotifcation" Align="Center">
<Editor>
<ext:Checkbox runat="server" ID="chkEmail"></ext:Checkbox>
</Editor>
</ext:BooleanColumn>
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
</SelectionModel>
<LoadMask ShowMask="true" />
<View>
<ext:GroupingView runat="server" ID="grpView" HideGroupedColumn="true" ShowGroupName="false"
GroupTextTpl='{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Alerts" : "Alert"]})'>
</ext:GroupingView>
</View>
</ext:GridPanel>
</form>
</body>
</html>