Problem with getting visual to work
Ok at first, I am new to this so bear with me. I have this page that displays data in a simple list. Nothing strange really. On each row there is an edit button to which when you click on it triggers a javascript that turns all the fields that are to be able to be edited on that row to edit mode:
- $(x).children(':lt(8)').each(function (i, e) {
- if (i == 2) { // The selection of authentication
- var html = $('<select>' + authlevelList.map(function (e) { return '<option name="' + e.value + '" value="' + e.id + '">' + e.value + '</option>'; }).join('') + '</select>');
-
- $(html).find('option').filter(function () {
- return $(this).text() == $(e).text();
- }).attr('selected', true);
-
- $(e).html(html);
- } else if (i == 4) { // The selection of group
- var html = $('<select>' + groupList.map(function (e) { return '<option name="' + e.value + '" value="' + e.id + '">' + e.value + '</option>'; }).join('') + '</select>');
-
- $(html).find('option').filter(function () {
- return $(this).text() == $(e).text();
- }).attr('selected', true);
-
- $(e).html(html);
- });
- editlist[lopnr] = true;
As you can see these that I have as an example are selects and here is the problem. Normal inuputs - no problem. Selections total crap is the end result as when I click the edit button again the text returns to normal but instead of displaying the text of the select now all out of the sudden it picks the value and throws that into the list.
The value is what I am planning to use as I call the save function but I still want to display the correct text.
Anyone that can tell in what direction I am doing wrong?