PDA

View Full Version : [CLOSED] check all MultiCombo items from javascript



prost
Apr 12, 2013, 2:42 PM
Hi,
Calling the selectAll() method on a MultiCombo in javascript does not work for me anymore. No checkboxes are checked.

I'm using:
Browser: IE8
Ext.NET: 2.2.0.25592 (latest from SVN).

Thanks,
Sander



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


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


<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
}
</script>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />


<ext:MultiCombo ID="mc" runat="server">
<Items>
<ext:ListItem Value="AAA" />
<ext:ListItem Value="BBB" />
</Items>
<Triggers>
<ext:FieldTrigger Tag="selectAll" Icon="SimplePlus" Qtip="Select all" />
</Triggers>
<Listeners>
<TriggerClick Handler="if (tag === 'selectAll') {
this.selectAll();
this.setRawValue('All are selected');
}" />
</Listeners>
</ext:MultiCombo>
</form>
</body>
</html>

Daniil
Apr 12, 2013, 5:00 PM
Hi Sander,

Thank you for the report. We are investigating a fix.

Vladimir
Apr 14, 2013, 2:50 PM
You cannot use setRawValue because if current raw value doesn't equal value from 'getDisplayValue' then multicombo will reparse current value from raw value

I suggest to override getDisplayValue for particular multicombo by adding custom config


<CustomConfig>
<ext:ConfigItem Name="getDisplayValue" Value="getDisplayValue" Mode="Raw" />
</CustomConfig>


and use this function


function getDisplayValue() {
if(this.valueModels && this.valueModels.length == this.store.getCount()) {
return "All are selected";
}
else {
return Ext.net.MultiCombo.prototype.getDisplayValue.call( this);
}
}


or override getDisplayValue for all multicombo


Ext.net.MultiCombo.override({
getDisplayValue : function () {
if(this.valueModels && this.valueModels.length == this.store.getCount()) {
return "All are selected";
}
else {
return this.callParent(arguments);
}
}
});

prost
Apr 15, 2013, 10:28 AM
Thx, the override works for me.

Just for the info; the code I posted came from an other thread.

http://forums.ext.net/showthread.php?16616-CLOSED-quot-Select-All-quot-option-in-MultiCombo

Regards,
Sander

Daniil
Apr 15, 2013, 12:55 PM
Just for the info; the code I posted came from an other thread.

http://forums.ext.net/showthread.php?16616-CLOSED-quot-Select-All-quot-option-in-MultiCombo


Thank you for the link. In that thread I have posted a link to the current thread to notify others who can be interested in.

Generally, not everything which works for Ext.NET v1 works for Ext.NET v2.