PDA

View Full Version : [CLOSED] MultiCombo selection via script



softmachine2011
Jul 24, 2012, 7:27 AM
Hi,

How must MultiCombo be selected using script code?

If we use setValue method, text is shown as expected, but no item is checked when combo is expanded:


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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title>Ext.NET Examples</title>
</head>
<body>
<ext:resourcemanager runat="server" />
<ext:MultiCombo ID="cmbTest" runat="server" Width="200" FieldLabel="Sample" LabelAlign="Top">
<Items>
<ext:ListItem Text="Text 1" Value="1" />
<ext:ListItem Text="Text 2" Value="2" />
</Items>
<Listeners>
<AfterRender Handler="cmbTest.setValue(['1', '2']);" />
</Listeners>
</ext:MultiCombo>
</body>
</html>

Thanks.

Daniil
Jul 24, 2012, 10:15 AM
Hi,

We will look at this issue, thanks for the report.

Vladimir
Jul 26, 2012, 4:15 PM
Hi,

Fixed in Ext.Net 2.1 (http://svn.ext.net/premium/branches/2.1). Please update and retest

softmachine2011
Jul 27, 2012, 6:30 AM
Thanks,

We will test it after vacations.

softmachine2011
Aug 20, 2012, 8:24 AM
Hi again,

Udpdated, tested and working as expected.

Thanks.

Daniil
Aug 21, 2012, 9:26 AM
Thanks for confirmation!

softmachine2011
Sep 21, 2012, 10:00 AM
Hi,

Seems to be broken again.



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

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html>
<html>
<head runat="server">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Store1.DataSource = this.Jobs;
this.Store1.DataBind();
}

private List<Job> Jobs
{
get
{
List<Job> jobs = new List<Job>();

for (int i = 1; i <= 50; i++)
{
jobs.Add(new Job(
i,
"Task" + i.ToString(),
DateTime.Today.AddDays(i),
DateTime.Today.AddDays(i + i),
(i % 3 == 0)));
}

return jobs;
}
}

public class Job
{
public Job(int id, string name, DateTime start, DateTime end, bool completed)
{
this.ID = id;
this.Name = name;
this.Start = start;
this.End = end;
this.Completed = completed;
}

public int ID { get; set; }
public string Name { get; set; }
public DateTime Start { get; set; }
public DateTime End { get; set; }
public bool Completed { get; set; }
}
</script>
<title>#FF Tweets</title>
</head>
<body>
<ext:ResourceManager runat="server" />
<script type="text/javascript">
var fnLoad = function () {
var multiCombo1 = Ext.getCmp('MultiCombo1');

multiCombo1.selectAll();
var selectedValues = multiCombo1.getValue();
multiCombo1.setValue(selectedValues);
};
</script>
<ext:MultiCombo ID="MultiCombo1" runat="server" AllowBlank="false" ValueField="ID"
DisplayField="Name" Width="240" Editable="false" SelectionMode="Checkbox" WrapBySquareBrackets="false">
<Store>
<ext:Store runat="server" ID="Store1" AutoLoad="false" WarningOnDirty="false" ShowWarningOnFailure="false"
TabIndex="-1" RemoteSort="false">
<Model>
<ext:Model runat="server" IDProperty="ID">
<Fields>
<ext:ModelField Name="ID" Type="Int" />
<ext:ModelField Name="Name" Type="String" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="Name" Direction="ASC" />
</Sorters>
<Listeners>
<Load Fn="fnLoad" />
</Listeners>
</ext:Store>
</Store>
</ext:MultiCombo>
</body>
</html>

Vladimir
Sep 21, 2012, 12:44 PM
Thank you for the repoprt. Fixed in SVN
By the way, selectAll is enough, you can remove 'setValue' calling