-
[CLOSED] Multiselect
Hi, this bug was introduced after the changes detailed in the thread below were made. Using the 'Drag/Drop (Insert Mode)' in the examples application, if you drag multiple items from the list on the right to the list on the left you will receive a 'Microsoft JScript runtime error: 'this.store.getAt(...)' is null or not an object' message.
http://forums.ext.net/showthread.php...-Dropped-items
If the original code is reinstated, the problem appears to go away.
The above error is generated in both IE7 and IE8. In Google Chrome the exception is not show but looking at the console there appears to be something the browser isn't happy with. Interestingly in Chrome, if you repeat the steps, it works correctly.
I'm rolling 1.2 and haven't tested it with any other versions.
Thanks,
Gav
-
Hi,
Confirmed, thanks for the report.
I think it's a bug in MultiSelect.
Here is a sample to reproduce the problem, just click on the button.
Example
Code:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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 runat="server">
<title>Ext.NET Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:MultiSelect
ID="MultiSelect1"
runat="server"
Width="300"
Height="250">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
<ext:ListItem Text="Item 3" Value="3" />
<ext:ListItem Text="Item 4" Value="4" />
<ext:ListItem Text="Item 5" Value="5" />
</Items>
<SelectedItems>
<ext:SelectedListItem Value="4" />
<ext:SelectedListItem Value="5" />
</SelectedItems>
</ext:MultiSelect>
<ext:Button runat="server" Text="Remove">
<Listeners>
<Click Handler="var store = MultiSelect1.store,
r = store.getAt(3);
store.remove(r);" />
</Listeners>
</ext:Button>
</form>
</body>
</html>
-
I've investigated further and a problem can be in DataView.
Here is the sample with all JS functions related to an error.
Needs more time to implement a possible fix.
Example
Code:
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!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 runat="server">
<title>Ext.NET Example</title>
<ext:ResourcePlaceHolder runat="server" Mode="ScriptFiles" />
<script type="text/javascript">
Ext.DataView.override({
onRemove : function(ds, record, index){
//The line below causes a "selectionChange" event, a MultiSelect listens this event,
//but viewIndex of removed node is not updated yet.
this.deselect(index);
this.all.removeElement(index, true);
this.updateIndexes(index);
if (this.store.getCount() === 0){
this.refresh();
}
}
});
Ext.ux.Multiselect.override({
onSelectionChange : function (view, selection) {
this.oldValue = this.hiddenField.dom.value;
this.hiddenField.dom.value = this.getValue(); //here an error occurs
this.hiddenIndexes.dom.value = this.getIndexes();
if (this.submitText) {
this.hiddenText.dom.value = this.getValue(this.displayField);
}
},
getValue : function (valueField) {
if (!this.rendered) {
return this.value || "";
}
var returnArray = [],
selectionsArray = this.view.getSelectedIndexes();
if (selectionsArray.length === 0) {
return '';
}
for (var i = 0; i < selectionsArray.length; i++) {
//selectionsArray[i] is a viewIndex which is not updated yet.
returnArray.push(this.store.getAt(selectionsArray[i]).get(((valueField != null) ? valueField : this.valueField)));
}
return returnArray.join(this.delimiter);
}
});
</script>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:MultiSelect
ID="MultiSelect1"
runat="server"
Width="300"
Height="250">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
<ext:ListItem Text="Item 3" Value="3" />
<ext:ListItem Text="Item 4" Value="4" />
<ext:ListItem Text="Item 5" Value="5" />
</Items>
<SelectedItems>
<ext:SelectedListItem Value="4" />
<ext:SelectedListItem Value="5" />
</SelectedItems>
</ext:MultiSelect>
<ext:Button runat="server" Text="Remove">
<Listeners>
<Click Handler="var store = MultiSelect1.store,
r = store.getAt(3);
store.remove(r);" />
</Listeners>
</ext:Button>
</form>
</body>
</html>
-
The bug ticket has been created:
https://extnet.lighthouseapp.com/projects/50526/tickets/211
The fix has been added to SVN, revision #3754.
Please update and re-test.