PDA

View Full Version : [CLOSED] RowSelectionModel interfering with GridCommand and RowExpander in EXT.Net 2.2



Fahd
Jun 24, 2013, 11:13 PM
The GridCommand and RowExpander click invokes RowSelectionModel in EXT.Net 2.2. It works perfect in Ext.Net 2.1.
Can you please let me know if this is a known issue in Version 2.2 or am I doing something wrong?


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ColumnSelection.aspx.cs"
Inherits="OffLineExtTest.ColumnSelection" %>

<%@ 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">
<script runat="server">



protected void Page_Load(object sender, EventArgs e)
{

if (!X.IsAjaxRequest)
{
List<Trailer> TrailerList = new List<Trailer>();
for (int i = 0; i < 10; i++)
{
var trailer = new Trailer
{
TID = i,
DestName = "D-" + i,
Routenumber = "R-" + i,
TrailerNumber = "T-" + i
};
TrailerList.Add(trailer);


}
this.stTrailer.DataSource = TrailerList;
this.stTrailer.DataBind();


}



}
public class Trailer
{
public int TID { get; set; }
public string DestName { get; set; }
public string Routenumber { get; set; }
public string TrailerNumber { get; set; }
}

public class TrailerStop
{
public int SID { get; set; }
public string StopName { get; set; }
}
[DirectMethod]
public void StopEditOnClick(int tid)
{
LabelTID.Text = "Command Click" +tid.ToString();
wnStopEdit.Show();
}

protected void RowSelectTrailerClicked(object sender, DirectEventArgs e)
{
try
{
string tid = int.Parse(!string.IsNullOrEmpty(e.ExtraParams["TID"]) ? e.ExtraParams["TID"] : "0").ToString();
//BtnTrailerEdit_OnDirectClick(tid);
X.Msg.Alert("RowSelection:",tid).Show();


}
catch (Exception ex)
{
X.Msg.Alert("Error", "Please select the correct trailer!").Show();
}
}

[DirectMethod]
public static string GetGrid(Dictionary<string, string> parameters)
{
string TID = parameters["TID"];

var panel = new Ext.Net.Panel()
{
Layout = "ColumnLayout"
};

List<TrailerStop> data1 = new List<TrailerStop>();
//data1 = TrailerStop.GetStopDetailsForTrailer(TID.AsInt());

for (int i = 0; i < 3; i++)
{
var trailerstop = new TrailerStop
{
SID = i,
StopName = "S-" + i
};
data1.Add(trailerstop);


}

GridPanel StopGrid = new GridPanel
{
ID = "StopGrid_" + TID,
Height = 130,
Width = 250,
EnableColumnHide = false,
Store =
{
new Store
{
Model = {
new Ext.Net.Model
{
IDProperty = "SID",
Fields =
{
new ModelField("SID"),
new ModelField("StopName")

}
}
},
DataSource = data1
}
},
ColumnModel =
{
Columns =
{
new Column {Text = "SID", DataIndex = "SID", Align = Alignment.Center},
new Column {Text = "StopName", DataIndex = "StopName", Align = Alignment.Center}

}
}
};


panel.Items.Add(StopGrid);
return ComponentLoader.ToConfig(panel);
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
var TrailerCommandClick = function (tid) {
App.direct.StopEditOnClick(tid);
};

</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="rmWorkSheet" runat="server" />
<ext:Panel ID="Panel1" runat="Server">
<Items>
<ext:GridPanel ID="TrailerGridPanel" runat="server" Height="450">
<Store>
<ext:Store ID="stTrailer" runat="server">
<Model>
<ext:Model ID="mdTrailer" runat="server" IDProperty="TID">
<Fields>
<ext:ModelField Name="TID" />
<ext:ModelField Name="DestName" />
<ext:ModelField Name="Routenumber" />
<ext:ModelField Name="TrailerNumber" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:CommandColumn ID="CommandColumn" runat="server" Width="60">
<Commands>
<ext:GridCommand Icon="Add" CommandName="Add">
<ToolTip Text="Show Window" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Handler="TrailerCommandClick(record.data.TID);" />
</Listeners>
</ext:CommandColumn>

<ext:Column ID="Column2" runat="server" Text="Final Dest Name" DataIndex="DestName" />
<ext:Column ID="IncomingTrailerStopName" runat="server" Text="Stop At" DataIndex="IncomingTrailerStopName"
Hidden="true" />
<ext:Column ID="Column10" runat="server" Text="Routenumber" DataIndex="Routenumber" />
<ext:Column ID="Column5" runat="server" Text="TrailerNumber" DataIndex="TrailerNumber" />
</Columns>
</ColumnModel>
<Loader ID="Loader1" runat="server" AutoLoad="false" Mode="Data">
</Loader>
<Plugins>
<ext:RowExpander ID="reTrailer" runat="server" SelectRowOnExpand="false">
<Loader ID="Loader2" runat="server" DirectMethod="#{DirectMethods}.GetGrid" Mode="Component">
<LoadMask ShowMask="true" />
<Params>
<ext:Parameter Name="TID" Value="this.record.getId()" Mode="Raw" />
</Params>
</Loader>
</ext:RowExpander>
</Plugins>

<SelectionModel>
<ext:RowSelectionModel ID="rsmTrailers" runat="server" >
<DirectEvents>
<Select OnEvent="RowSelectTrailerClicked" Buffer="100">
<ExtraParams>
<ext:Parameter Name="TID" Value="record.data.TID" Mode="Raw"></ext:Parameter>
</ExtraParams>
</Select>
</DirectEvents>
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
</Items>
</ext:Panel>
<ext:Window ID="wnStopEdit" runat="server" Height="250" Width="400" BodyStyle="background-color: #fff;"
BodyPadding="1" Modal="true" OverflowY="Hidden" Resizable="true" Title="Update Stop Details"
Hidden="true" Floatable="true">
<Items>
<ext:Panel ID="Panel4" runat="server" Border="false" StyleSpec="padding-top:1px;padding-bottom:1px; padding-left:150px;"
Layout="ColumnLayout">
<Items>
<ext:Panel ID="Panel5" runat="server" ColumnWidth=".75" Border="false" ButtonAlign="Center">
<Items>
<ext:Label ID="LabelTID" runat="server" Height="10"></ext:Label>

</Items>
<Buttons>
<ext:Button ID="Button1" Text="Exit" runat="server" Icon="Cancel">
<Listeners>
<Click Handler="#{wnStopEdit}.hide();">
</Click>
</Listeners>
</ext:Button>
</Buttons>
</ext:Panel>
</Items>
</ext:Panel>
</Items>
</ext:Window>
</form>
</body>
</html>




Here is the code

Baidaly
Jun 25, 2013, 12:33 AM
Hello!

As I understand when you expand RowExpander and click RowCommands you invoke Select event of the Grid. But I couldn't reproduce with our trunk, can you update and retest? If you already use the last sources can you provide steps to reproduce?