cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
xxvvcczz
Level III

Workarounds for the dreaded Row State Handler

Drag a selection box on the graph, then gather your selected rows up into JSON and fire them off to a localhost server tow ork in html/javascript land

 

I use the scheduler to pile in the useless spam of unwanted events constantly clearing the queue to prevent the slew of spam events from firing.

 

I've tried using mousebox stuff before, including totally rewriting the selection mechanic, but it was laggy and had too many of its own drawbacks:

https://community.jmp.com/t5/Discussions/Is-there-a-way-to-make-the-rowstate-handler-less-laggy/m-p/...

 

// This is the row state handler
f = Function({x},
	try(s << Clear Schedule);
	//wait(2);
	if(Is Empty(last_array),last_array = -1);
	current_array = summary_jmp_table << get selected rows();
	/**/
	// These "If" conditions stop it from needlessly spamming events out to the server that's going to draw an interactive app
	// Can't just compare 2 arrays to see if they are exactly the same. It tries to compare every number in the 2 arrays by index position, so the SUM of that is used to tell if they are different.
	if((length(current_array) >0) & (sum(current_array) != sum(last_array)) & (global_iframe_counter>0) ,
		//show("we have a go");
		s = Schedule(.225,		
			//json = As JSON Expr(current_array);
			json = sel_rows_2_JSON(); //a function that gets selected rows and bundles them up into JSON to send my data request
			request = New HTTP Request(
				URL("localhost:8088/jmp_data"),
				Method("Post"),
				Timeout( .001 ),
				JSON(json),
			);
		//data=request << Send;
		//show(data);
		//wait(0);
		try(s << Stop);
		try(s << Clear Schedule);
		//wait(0);	
		last_array = current_array;
		// saves the last array, this stops it from spamming out events for no reason when you hover over points on a graph. 
		//I don't know WHY hover fires a row state event, but it does.	 
		data=request << Send;			
		), // end schedule
		//show("didn't meet IF condition somehow");
	); // end if
);// end function f

 

 

 

2 REPLIES 2
jthi
Super User

Re: Workarounds for the dreaded Row State Handler

Could you implement a button which is pressed to send the data after the selection has been done?

-Jarmo
xxvvcczz
Level III

Re: Workarounds for the dreaded Row State Handler

@jthi 

That's how I started, but I don't like it because it's clunky and breaks the flow.

 

What I really want is something that works like a javascript selection event.