Jul 19, 2015, 9:49 AM
[CLOSED] gridpanel / hightlight row trouble/
Hello,
I am trying to highlight some rows when pressing a command in a gridpanel. When I select it in the corresponding gridpanel the view updates automaticly and in this case has a highlighted row. If I update a row in another gridpanel. The value is correctly set but the view isn't updated. Thank you for a hint where my thoughts go wrong... ;)
best regards.
I am trying to highlight some rows when pressing a command in a gridpanel. When I select it in the corresponding gridpanel the view updates automaticly and in this case has a highlighted row. If I update a row in another gridpanel. The value is correctly set but the view isn't updated. Thank you for a hint where my thoughts go wrong... ;)
best regards.
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = this.Data;
this.Store1.DataBind();
this.Store2.DataSource = this.Data;
this.Store2.DataBind();
}
}
private object[] Data
{
get
{
return new object[]
{
new object[] { "3m Co", 0 },
new object[] { "Alcoa Inc", 0 },
new object[] { "Altria Group Inc", 0 },
new object[] { "American Express Company", 0 },
new object[] { "American International Group, Inc.", 0 }
};
}
}
</script>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Test</title>
<style>
.sel-row .x-grid-cell, .sel-row .x-grid-rowwrap-div {
background: #c8ffc8 !important;
}
</style>
<script>
var getSelectedRowClass = function (record) {
if (record.data.SELECTED > 0) {
return "sel-row";
}
};
</script>
</head>
<body>
<ext:ResourceManager runat="server" Locale="de-ch" />
<ext:GridPanel
runat="server"
Title="GridPanel 1"
ID ="gp1"
Frame="true"
Width="400"
Height="295">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="company" />
<ext:ModelField Name="SELECTED" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" Text="Company" DataIndex="company" Flex="1" />
</Columns>
</ColumnModel>
<View>
<ext:GridView>
<GetRowClass Fn="getSelectedRowClass"></GetRowClass>
</ext:GridView>
</View>
</ext:GridPanel>
<ext:GridPanel
runat="server"
Title="GridPanel 2"
ID="gp2"
Frame="true"
Width="400"
Height="295">
<Store>
<ext:Store
id ="Store2"
runat="server">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="company" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel runat="server">
<Columns>
<ext:Column runat="server" Text="Company" Flex="1" DataIndex="company" />
<ext:CommandColumn runat="server" Width="25">
<Commands>
<ext:GridCommand CommandName="highlight"></ext:GridCommand>
</Commands>
<Listeners>
<Command Handler="#{Store1}.findRecord('company', 'Alcoa Inc', 0, false, false, true).set('SELECTED', 1);"></Command>
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>
</body>
</html>
Last edited by Daniil; Jul 21, 2015 at 7:12 PM.
Reason: [CLOSED]