Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Still would like a non-hack solution, but have come up with a hack that works.</p> <p>What you do is set up a conditional block in the AJAX call page that generates the HTML object, in this case a select box populated by the data from the actors column. Used PHP explode(',',$myarray) to parse the data and a loop to set up the select options. Then add the JavaScript needed for event handlers to pass selected values and call to another JavaScript function to pass the data, I'm using POST, to another PHP page to update the database. With all that in place, I substituted the HTML string for the line json value of the cell(for a given row) or column(looking at the whole grid). </p> <p>On the columnModel, you have to remove the editable:true. Other wise it is possible for a user to click on a margin/padding space of one or two pixels that can not be hidden by the select button, no matter what height property I gave the select box, which results in the HTLM string being displayed in that cell. Also you need to place all the JavaScript on the same code line as the selectbox, I used a variable set to the HTML string generated in my conditional block, otherwise the grid adds a line break, or rather what seems and acts like a line break to the table cell the select box is placed in. This causes the format of the grid cells to have increased height. </p> <pre><code>$responce-&gt;rows[$i]['cell']=array($row['ID'],$row['movie'], $row['topic'],$row['rating'],'&lt;select id="actors'.$i.'"style="width:100%;"&gt;&lt;option value="what the'.$therowid.'"&gt;ed&lt;/option&gt;&lt;option value="zed"&gt;zed&lt;/option&gt;&lt;option value="red"&gt;red&lt;/option&gt;&lt;/select&gt;&lt;script&gt;$("#actors'.$i.'").change(function(){var actorselected =$("#actors'.$i.' option:selected").val();alert("you changed select box actors'.$i.' with record id '.$therowid.'\nThe selected value is "+actorselected);});/script&gt;'); </code></pre> <p>The above code is from a static try not using the DB, but does demonstrate how it works.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload