PDA

View Full Version : [CLOSED] CellSelectionModel goes to first column



mtsig
Feb 11, 2014, 10:05 AM
Hello,

i have a problem with CellSelectionModel in a gridpanel.
In the example below when you scroll to the last column and click for edit the grid goes to first column (i think ) with no focus anywhere.
This happens only in IE. On Firefox and Chrome works ok.

Any help please ?


<%@ Page Language="C#" %>
<%@ Import Namespace="System.Collections.Generic" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = new List<Project>
{
new Project(10, 2, 3 ,4 ,5 ,6 ,7 ,8 ,9, 10, 11, 12, 13, 14, 15),
new Project(11, 2, 3 ,4 ,5 ,6 ,7 ,8 ,9, 10, 11, 12, 13, 14, 15),
new Project(12, 2, 3 ,4 ,5 ,6 ,7 ,8 ,9, 10, 11, 12, 13, 14, 15)

};

this.Store1.DataBind();
}

public class Project
{
public Project(double a01, double a02, double a03, double a04, double a05, double a06, double a07, double a08, double a09, double a10,
double a11, double a12, double a13, double a14, double a15 )
{
this.A01 = a01;
this.A02 = a02;
this.A03 = a03;
this.A04 = a04;
this.A05 = a05;
this.A06 = a06;
this.A07 = a07;
this.A08 = a08;
this.A09 = a09;
this.A10 = a10;
this.A11 = a11;
this.A12 = a12;
this.A13 = a13;
this.A14 = a14;
this.A15 = a15;
}

public double A01 { get; set; }
public double A02 { get; set; }
public double A03 { get; set; }
public double A04 { get; set; }
public double A05 { get; set; }
public double A06 { get; set; }
public double A07 { get; set; }
public double A08 { get; set; }
public double A09 { get; set; }
public double A10 { get; set; }
public double A11 { get; set; }
public double A12 { get; set; }
public double A13 { get; set; }
public double A14 { get; set; }
public double A15 { get; set; }
public double A16 { get; set; }
public double A17 { get; set; }
public double A18 { get; set; }
public double A19 { get; set; }
public double A20 { get; set; }

}
</script>

<html>
<head runat="server">

</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server"/>

<ext:GridPanel
ID="GridPanel1"
runat="server"
Frame="true" Layout="FitLayout"

Height="800">
<Store>
<ext:Store ID="Store1" runat="server" GroupField="ProjectName">
<Model>
<ext:Model runat="server" IDProperty="A01">
<Fields>
<ext:ModelField Name="A01" Type="Int" />
<ext:ModelField Name="A02" Type="Float" />
<ext:ModelField Name="A03" Type="Float" />
<ext:ModelField Name="A04" Type="Float" />
<ext:ModelField Name="A05" Type="Float" />
<ext:ModelField Name="A06" Type="Float" />
<ext:ModelField Name="A07" Type="Float" />
<ext:ModelField Name="A08" Type="Float" />
<ext:ModelField Name="A09" Type="Float" />
<ext:ModelField Name="A10" Type="Float" />
<ext:ModelField Name="A11" Type="Float" />
<ext:ModelField Name="A12" Type="Float" />
<ext:ModelField Name="A13" Type="Float" />
<ext:ModelField Name="A14" Type="Float" />
<ext:ModelField Name="A15" Type="Float" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Plugins>
<ext:CellEditing runat="server" ClicksToEdit="1" />
</Plugins>
<ColumnModel runat="server">
<Columns>
<ext:Column ID="Column1" runat="server" Text="A01" DataIndex="A01" Width="200" >
<Editor>
<ext:NumberField runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column2" runat="server" Text="A02" DataIndex="A02" Width="200" >
<Editor>
<ext:NumberField ID="NumberField1" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column3" runat="server" Text="A03" DataIndex="A03" Width="200" >
<Editor>
<ext:NumberField ID="NumberField2" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column4" runat="server" Text="A04" DataIndex="A04" Width="200" >
<Editor>
<ext:NumberField ID="NumberField3" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column5" runat="server" Text="A05" DataIndex="A05" Width="200" >
<Editor>
<ext:NumberField ID="NumberField4" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column6" runat="server" Text="A06" DataIndex="A06" Width="100" >
<Editor>
<ext:NumberField ID="NumberField5" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column7" runat="server" Text="A07" DataIndex="A07" Width="100" >
<Editor>
<ext:NumberField ID="NumberField6" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column8" runat="server" Text="A08" DataIndex="A08" Width="100" >
<Editor>
<ext:NumberField ID="NumberField7" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column9" runat="server" Text="A09" DataIndex="A09" Width="100" >
<Editor>
<ext:NumberField ID="NumberField8" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column10" runat="server" Text="A10" DataIndex="A10" Width="100" >
<Editor>
<ext:NumberField ID="NumberField9" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column11" runat="server" Text="A11" DataIndex="A11" Width="100" >
<Editor>
<ext:NumberField ID="NumberField10" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column12" runat="server" Text="A12" DataIndex="A12" Width="100" >
<Editor>
<ext:NumberField ID="NumberField11" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column13" runat="server" Text="A13" DataIndex="A13" Width="100" >
<Editor>
<ext:NumberField ID="NumberField12" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column14" runat="server" Text="A14" DataIndex="A14" Width="100" >
<Editor>
<ext:NumberField ID="NumberField13" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>
<ext:Column ID="Column15" runat="server" Text="A15" DataIndex="A15" Width="100" >
<Editor>
<ext:NumberField ID="NumberField14" runat="server" SelectOnFocus = true DecimalSeparator = "," DecimalPrecision = 2 HideTrigger = true />
</Editor>
</ext:Column>

</Columns>
</ColumnModel>
<SelectionModel>
<ext:CellSelectionModel runat="server" />
</SelectionModel>
</ext:GridPanel>
</form>
</body>
</html>

Daniil
Feb 11, 2014, 1:32 PM
Hi @mtsig,

Please try this fix.
http://forums.ext.net/showthread.php?27937&p=124773&viewfull=1#post124773

mtsig
Feb 12, 2014, 11:41 AM
The link have the above code but this line if (!Ext.isIE) returns always false because i have Internet Explorer 11


Ext.override(Ext.view.Table, {
focusRow: function (rowIdx) {
var me = this,
row,
gridCollapsed = me.ownerCt && me.ownerCt.collapsed,
record;

if (me.isVisible(true) && !gridCollapsed && (row = me.getNode(rowIdx, true)) && me.el) {
record = me.getRecord(row);
rowIdx = me.indexInStore(row);

me.selModel.setLastFocused(record);
if (!Ext.isIE) {
row.focus();
}

me.focusedRow = row;
me.fireEvent('rowfocus', record, row, rowIdx);
}
}
});

Daniil
Feb 12, 2014, 12:01 PM
So, is "Ext.isIE" true or false?

You said that "!Ext.isIE" is false, it means "!true". Respectively, Ext.isIE is true. That is correct.

If you mistyped and "Ext.isIE" is false, then please update from the SVN trunk and re-test.