I have a problem with some functionality on one of my pages.
I have a CGridview filled with some data from a MySQL database. When I click the ‘edit’ button ( 1. in the picture)at the end of the table, the div with the gridview closes (is hidden) and another div with a form to edit the data is shown (is unhidden). This is done using javascript.
When I first load a page, this works fine, but after I filter the data ( 2. in the picture) or when I go to a different page of results (3. in the picture), this suddenly stops working. The Edit button doesn’t do anything anymore after I do any of these actions…
Any idea what causes this? And how I would go about fixing it?
This bit adds a clickevent to the table in the gridview when the page loads:
function run(e) {
var tabel;
tabel = document.getElementsByClassName("items")[0];
if (tabel === undefined) {
alert("not found");
return;
}
tabel.addEventListener("click", tabelclick, false);
}
window.addEventListener("load", run, false);
This bit defines the clickevent. It says to call upon the function ‘showDetails’ when an image is clicked inside the gridview (the edit button is the only image inside the gridview). It also fills the edit form with data taken from the table.