Subclass ComboBoxItem

I am trying to create a class based on ComboBoxItem:

isc.ClassFactory.defineClass("ListComboBoxField", "ComboBoxItem");
isc.ListComboBoxField.addProperties({
	keyPress: function () 
	{
	var inValidChars = "0123456789@#$%^&*()-_=+[]{}\|;:',.<>/?" + '"';
		var keyName = isc.EventHandler.getKey();
		if (inValidChars.indexOf(keyName) == -1)
			return true;
		else 
			return false;
	},
	changed: function (form, item, value)
	{
		if (isc.EventHandler.getKey() == 'Delete' || typeof(isc.EventHandler.getKey()) == undefined || isc.EventHandler.leftButtonDown() == true)
		{
			item.focusInItem();
			if (this.propRunCode != undefined)
				eval(this.propRunCode)(value);	
		}		
	}
});

Is that correct way of doing it? The reason I am asking is because when I click on an arrow to drop the control I am getting an error :‘Undefined’ is null or not an object"

Thanks

Hi Mark
From eyeballing your code it looks like this is actually a JS coding error in changed - you’re comparing a couple of things to undefined - but “undefined” hasn’t been defined as a variable and is not a keyword in JS.

You should probably be comparing to null instead.

See if this fixes it. If not - let us know and we’ll take another look

No, I think it’s a problem in 5.7.
Steps to replicate:

  1. Go http://www.smartclient.com/docs/5.7/a/system/reference/SmartClient_Explorer.html#_Grids_Editing_Edit.by.cell
  2. go to JS and change continent to look like this:
    {name:“continent”, editorType:“comboBox”},
  3. Try it, then select any cell in a column Continent and try to drop the combo down. You should be getitng same error.

Hi Mark
Thanks for the very clear bug report. We do see this problem and it is a SmartClient bug.
I’ve passed this on to our development team who were able to get a fix in right away.

We’ll let you know when the fix is available, either as part of an upcoming 5.7.1 build or as a separate patch.

Regards
Isomorphic Software

It would be nice to know when that might happen.

I am testing that problem in
http://www.smartclient.com/docs/5.7.1/a/system/reference/SmartClient_Explorer.html#_Grids_Editing_Edit.by.cell

and it is still the same???

Hi Mark
We’ve been attempting to reproduce this bug and it is not happening for us on the 5.7.1-specific URL.

You might want to start by clearing your browser cache to ensure that you’re not acutally working with an earlier version of SmartClient.

Other than that:

  • Which browser (including version number) are you seeing the bug on?
  • Can we just verify that the steps are the same as before: Namely:
  1. Go to http://www.smartclient.com/docs/5.7.1/a/system/reference/SmartClient_Explorer.html#_Grids_Editing_Edit.by.cell (that’s the 5.7.1 version, not the 5.7 version)
  2. go to JS and change continent to look like this:
    {name:“continent”, editorType:“comboBox”},
  3. Try it, then select any cell in a column Continent and try to drop the combo down.

[Result: JavaScript error ‘Undefined’ is null or not an object"]

Thanks
Isomorphic Software

The steps are correct accept that when you select a cell it gets highlighted. Click again on it and then drop the combo down.

Any word on when that can be possibly fixed?

Thanks

Hi Mark
We’ve now managed to reproduce this issue,
The extra step of deselecting the text before showing the drop down, together with the fact that this only occurs on Internet Explorer were what did it.

We’ll let you know as soon as we have more information

Thanks
Isomorphic Software

Thank you.

Hi Mark
A patch is now available in the Addendums forum, here

Let us know if this doesn’t resolve the issue for you

Thanks
Isomorphic Software

Looks like it helped. Thanks

Urgent!!

I was too optimistic. It still does not work.
I am getting ‘undefined’ is not an object and debugger points to this block of code:

if ((pickList && (event.eventType == "selectionChange" && pickList.contains(isc.EH.mouseDownTarget()))
|| ((event.eventType == EH.MOUSE_DOWN || event.eventType == EH.CLICK) && pickList.contains(event.target,true))) ||
(isc.Browser.isIE && this.getActiveElement() == this.getDataElement())) {return;}

Looks like pickList is undefined.
Steps to replicate:
With a mouse highlight the whole value of the combobox. Drop it down.

Hi Mark
I was unable to reproduce the bug with the patch as we published it.. However if pickList was null, I see how you could get into a bad state with that code.

I’ve tweaked the patch code to make this safe- you can get the reworked version from the same page http://forums.smartclient.com/showthread.php?t=875

If this still doesn’t do it, let me know.

Thanks

Paul
Isomorphic Software

Thanks for updated code.
I am using IE 7 and and it’s reproducable every time. Just highlight combobox with a mouse and try to show dropdown part.

Can’t break it now :slight_smile: Thanks for the help.