PDA

View Full Version : [CLOSED] ComponentColumn TriggerField setValue



CPA1158139
Mar 07, 2013, 6:21 AM
I want to click [setValue] button in subWindow of column 3 (TriggerField), its value (TriggerField' value) should be changed, but it has not changed.
pls help .
thanks.



<%@ Page Language="C#" %>

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

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.Store1.DataSource = new object[]
{
new object[] { 1, 1, "Text 1", DateTime.Now.Date },
new object[] { 2, 2, "Text 2", DateTime.Now.Date },
new object[] { 3, 3, "Text 3", DateTime.Now.Date },
new object[] { 4, 4, "Text 4", DateTime.Now.Date },
new object[] { 5, 5, "Text 5", DateTime.Now.Date },
new object[] { 6, 6, "Text 6", DateTime.Now.Date },
new object[] { 7, 7, "Text 7", DateTime.Now.Date },
new object[] { 8, 8, "Text 8", DateTime.Now.Date },
new object[] { 9, 9, "Text 9", DateTime.Now.Date }
};

this.Store1.DataBind();
}
}
</script>

<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
<title>ComponentColumn Over Editor - Ext.NET Examples</title>
<link href="/resources/css/examples.css" rel="stylesheet" />
<script>
var triggerClick = function (el, trigger, tag, auto, index) {
Ext.getCmp('Window1').show();
Ext.getCmp('Hidden1').setValue(el.id);
};

var setTri = function () {
//debugger;
var triValue = Ext.getCmp('Hidden1').getValue();
var value1 = 'value:' + triValue;
Ext.getCmp(triValue).setValue(value1);
Ext.getCmp('Window1').hide();
};

</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Hidden runat="server" ID="Hidden1">
</ext:Hidden>
<h1>ComponentColumn as Over Editor</h1>

<ext:GridPanel ID="GridPanel1"
runat="server"
Title="ComponentColumn Over Editor"
Width="600"
Height="300">
<Store>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="IntField" Type="Int" />
<ext:ModelField Name="ComboField" Type="Int" />
<ext:ModelField Name="TextField" Type="String" />
<ext:ModelField Name="DateField" Type="Date" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:ComponentColumn ID="ComponentColumn1"
runat="server"
Editor="true"
OverOnly="true"
DataIndex="IntField"
Flex="1"
Text="Integer">
<Component>
<ext:NumberField ID="NumberField1" runat="server" />
</Component>
</ext:ComponentColumn>

<ext:ComponentColumn ID="ComponentColumn2"
runat="server"
Editor="true"
OverOnly="true"
DataIndex="ComboField"
Flex="1"
PinEvents="expand"
UnpinEvents="collapse"
Text="ComboBox">
<Component>
<ext:ComboBox ID="ComboBox1" runat="server">
<Items>
<ext:ListItem Text="Item 1" Value="1" Mode="Raw" />
<ext:ListItem Text="Item 2" Value="2" Mode="Raw" />
<ext:ListItem Text="Item 3" Value="3" Mode="Raw" />
<ext:ListItem Text="Item 4" Value="4" Mode="Raw" />
<ext:ListItem Text="Item 5" Value="5" Mode="Raw" />
<ext:ListItem Text="Item 6" Value="6" Mode="Raw" />
<ext:ListItem Text="Item 7" Value="7" Mode="Raw" />
<ext:ListItem Text="Item 8" Value="8" Mode="Raw" />
<ext:ListItem Text="Item 9" Value="9" Mode="Raw" />
</Items>
</ext:ComboBox>
</Component>
</ext:ComponentColumn>


<ext:ComponentColumn ID="ComponentColumn5"
runat="server"
Editor="true"
OverOnly="true"
DataIndex="TextField"
Flex="1"
PinEvents="expand"
UnpinEvents="collapse"
Text="trigText">
<Component>
<ext:TriggerField runat="server">
<Triggers>
<ext:FieldTrigger Icon="SimpleEllipsis" Tag="pick" />
</Triggers>
<Listeners>
<TriggerClick Handler="triggerClick(this, trigger, tag, true, 0);" />
</Listeners>
</ext:TriggerField>
</Component>
</ext:ComponentColumn>

<ext:ComponentColumn ID="ComponentColumn4"
runat="server"
Editor="true"
OverOnly="true"
DataIndex="DateField"
Flex="1"
PinEvents="expand"
UnpinEvents="collapse"
Text="Date">
<Renderer Format="Date" FormatArgs="'d/m/Y'" />
<Component>
<ext:DateField ID="DateField1" runat="server" Format="dd/MM/yyyy" />
</Component>
</ext:ComponentColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>
<ext:Window runat="server" ID="Window1" Modal="true" Width="100" Height="200" Hidden="true" Title="subWindow">
<Items>
<ext:Button ID="Button1" runat="server" Text="SetValue" Handler="setTri();" />
</Items>
</ext:Window>
</form>
</body>
</html>

Daniil
Mar 07, 2013, 9:10 AM
Hi @CPA1158139,

As I can see a TriggerField is just hidden when the Window opens. Do you want to avoid it?

CPA1158139
Mar 07, 2013, 2:12 PM
Yes.
I hope that when I click on the [setValue] button, TriggerField 's Text is displayed as value:ctl6.
I do not know how to achieve.

pls help,thank you very much!




Hi @CPA1158139,

As I can see a TriggerField is just hidden when the Window opens. Do you want to avoid it?

Daniil
Mar 07, 2013, 6:31 PM
I would try the following override.

Example

Ext.grid.column.ComponentColumn.override({
onItemMouseLeave : function (view, record, item, index, e) {
var me = this;

if (this.pin || App.Window1.isVisible()) {
return;
}

if (me.showDelayTask) {
clearTimeout(me.showDelayTask);
delete me.showDelayTask;
}

if (me.hideDelay) {
if (me.hideDelayTask) {
clearTimeout(me.hideDelayTask);
}

me.hideDelayTask = setTimeout(function () {
me.hideComponent(view, record, item, index, e);
}, me.hideDelay);
} else {
me.hideComponent(view, record, item, index, e);
}
}
});

CPA1158139
Mar 08, 2013, 2:44 AM
It is already OK.
Your level is too high!
Thanks.