3.2.0

Radio button in a cell losing its focus on sort

OK, so I put a radio button in one my cells and even assigned an onchange function that works. But after I have selected the button (so it is filled in) and then do a sort, the button then loses its selection and appears empty again.

Any thoughts on fixing this?

Here's some sample data:

var dataList =
[

['<input onselect="loadPADDetail(this)" onclick="loadPADDetail(this)" id="listF120158" name="listF120158" type="radio" alwaysEnabled="true" value="001"></input>', "001", "7", "01/08/2003", "", "N", "50.05", "xxx", "Bank of America, National Association", "xxx"],

['<input onselect="loadPADDetail(this)" onclick="loadPADDetail(this)" id="listF120158" name="listF120158" type="radio" alwaysEnabled="true" value="002"></input>', "002", "5", "01/10/2003", "01/10/2004", "A", "50.05", "xxx", "Bank of America, National Association", "xxx"],

['<input onselect="loadPADDetail(this)" onclick="loadPADDetail(this)" id="listF120158" name="listF120158" type="radio" alwaysEnabled="true" value="003"></input>', "003", "8", "01/10/2003", "02/00/2003", "N", "50.50", "xxx", "Bank of America, National Association", "xxx"],

['<input onselect="loadPADDetail(this)" onclick="loadPADDetail(this)" id="listF120158" name="listF120158" type="radio" alwaysEnabled="true" value="004"></input>', "004", "9", "01/08/2003", "02/00/2003", "N", "55.55", "xxx", "Bank of America, National Association", "xxx"],

]
;

Chadd Whistler
February 24,
When you sort the grid - it repaints itself re-requesting the values from the array. In order to keep your radio button value you need to write it back to the array, so that the data always reflects the current state.
Alex (ActiveWidgets)
February 24,
Yeah I just noticed from some other posts that this might be the case. So the same thing would apply to adding and removing rows too right? I just perform all operations on my data array and then just call refresh() on my grid object right?

I'm not much of a hacker so I have a hard time digging through code to figure out how to do something but I'm trying. I really just need a good example of setting my own event on the grids inherent row selection. With that I can get rid of the radio control altogether. I would just create a function that would be executed when a row is selected in the grid that would then get a value from a column of the selected grid row or use that index to get the data from my array and then perform my other functions.

So just to ask, even when I sort by another column, the getProperty("selection/index"); still returns the correct index to access my data array right? So I select the first row which would be index 0 in my data array and then resort the table which makes the first row go to the bottom, calling getProperty("selection/index") would still return 0 right?

thanks

Chadd Whistler
February 24,
So I found this example in one of the forum post's but when executed, it gives me the index of the previous row selected, not the current row.

obj1.setAction("click", gridItemSelected);

function gridItemSelected()
{
var idx = obj1.getProperty("selected/index");
}

I'm assuming then that my click event is getting fired before the inherent grid events?
Chadd Whistler
February 24,
You need to use action "selectionChanged" instead:

http://www.activewidgets.com/documentation/tutorial/grid/selection.htm

Alex (ActiveWidgets)
February 24,

This topic is archived.

See also:


Back to support forum