What I had done:
I had successfully put the data of a MySQL table into the table widget component like I wanted. the instructions are pretty simple to do - as it's commented in the PHP script.
What I wanted:
To get the id value (the very first field's value) of the row that I was selecting and place it into a hidden variable.
So we're doing this with PHP right. within the 'examples' folder there is a 'php' folder - in that there are two php files. ActiveWidgets and basic.
Take a look at the ActiveWidgets... it has a function there that will place all the data in there that you want.
You need to put the following code in just before this line:
$html .= " document.write($name);\n";
here's the code you need to place in before the line above:
Make sure you're echo-ing out (or assigning - if your using SmartTemplates) the widget on a form... call the form 'form_widget'... then have a hidden variable in there called 'widget_id' - now because I was wanting to capture the first field's value (it was my mysql database id value) I set the
- for some reason the object's properties are object[row][field] - I would think it should be field and then row - arrays are better organised like [field][row] - if you read the code above you'll immediatly pick that up. src.getItemProperty ('index') is the row value that has been selected.
I had a serious problem with the selection of an item. because I would run the code with this other method, but it would stop the widget from displaying the selected row... you'd click on a row and it wouldn't highlight blue... This solves the problem though...