Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Filtering ShapeList in client-side (Read 3118 times)
Mohammad
YaBB Newbies
*
Offline


Hello everybody :)

Posts: 32
Joined: Oct 2nd, 2009
Filtering ShapeList in client-side
Oct 2nd, 2009 at 1:32am
Print Post  
Hi

I try to filter ShapeListBox items with javascript:

function filter(){
var shapeListApplet = document.getElementById('ShapeListBox');
var shapeList = shapeListApplet.getShapeListBox();
var scriptHelper = shapeListApplet.getScriptHelper();
var shape1 = scriptHelper.shapeFromId("Start");
var shape2 = scriptHelper.shapeFromId("Email");
shapeList.clearShapes();
shapeList.addShape(shape1);
shapeList.addShape(shape2);
}

But there is an error in the following line:
var shapeList = shapeListApplet.getShapeListBox();

Error: "Object doesn't support this property or method"

ClientSideMode is JavaApplet. Is there any solution?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Filtering ShapeList in client-side
Reply #1 - Oct 2nd, 2009 at 8:13am
Print Post  
Hi,

The client-side applet id is not the same as the .NET control's ID, so shapeListApplet is null. You could use the AppletID property to get the correct id, or initialize shapeListApplet like this:

var shapeListApplet = <%= ShapeListBox.AppletElement %>;

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Mohammad
YaBB Newbies
*
Offline


Hello everybody :)

Posts: 32
Joined: Oct 2nd, 2009
Re: Filtering ShapeList in client-side
Reply #2 - Oct 2nd, 2009 at 11:42am
Print Post  
Dear Stoyan.
Actually at first I'd used your code to find the applet. But javascript doesn't accept it and it has compile error! maybe there is something missed. I've put my javascript functions in a js file.

By the way, shapeListApplet is not null when I use document.getElementById method! if you trace it in visual Studio, you will find that it returns shapeList object with all properties and methods!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Filtering ShapeList in client-side
Reply #3 - Oct 2nd, 2009 at 1:01pm
Print Post  
Hi,

Indeed <%= ShapeListBox.AppletElement %> won't work from a .js file because that expression must be processed by the aspx page handler. What you get from getElementById(ID) is a DIV element that contains the applet. You could use this id to get the applet object: "_mfusion_" + controlID + "_Applet".

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Mohammad
YaBB Newbies
*
Offline


Hello everybody :)

Posts: 32
Joined: Oct 2nd, 2009
Re: Filtering ShapeList in client-side
Reply #4 - Oct 2nd, 2009 at 1:39pm
Print Post  
Thank you Stoyan. It works perfectly. Smiley
  
Back to top
 
IP Logged
 
mark korn
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Dec 2nd, 2009
Re: Filtering ShapeList in client-side
Reply #5 - Feb 23rd, 2010 at 10:25am
Print Post  
Or you can have a function in .aspx like this:

function getAppletElement() {
var shapeList= document.getElementById('shapeList');
if (shapeList)
return shapeList;
return null;
}

and acces the applet in .js file like this

var shapeList = getAppletElement();
It works for me Smiley

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint