Issues with dropdown list if you use the inline edit

QuestionsIssues with dropdown list if you use the inline edit
Massimo Gagliardi asked 8 years ago

Hi Abu
I noted that if you use the inline edit and you have some fields with dropdown lists (from database) the dropdown list doesn't show the choise active but seems behave how was an add action, with the dropdown list without any selection.
However the tooltip of the dropdown shows the choise active.
Then I used the below script:

$col["editoptions"]["dataInit"] = "function(){ setTimeout(function(){setVatDefault();},200); }";

function setVatDefault() {
var vatDefault = $("td[aria-describedby='list2_IDCodiceVat']").attr('title');
if (vatDefault == "undefined") {
var rowid = $('#list1').getGridParam('selrow');
var ifVat = $("#list1").jqGrid("getCell", rowid, "ID4");
if (ifVat != 0)
vatDefault = $("#list1").jqGrid("getCell", rowid, "VatDefault");
else
vatDefault = '';
}
$('#list2 select[name="IDCodiceVat"] option').filter(function() {
return $(this).text() == vatDefault;
}).prop('selected', true);
}

Can you suggest me a better way?
Thanks in advance
Massimo Gagliardi

2 Answers
Abu Ghufran answered 8 years ago

It should work and show database value preset in dropdown in case of inline edit.
You can review demos/appear/dropdown.php

Most probable issue could be that … you database get_dropdown_value() function should have 'field1 as k' value exactly to what is selected in select_command query.

See 'client_id' used both in dropdown function 'client_id as k' and also in query.

$str = $g->get_dropdown_values("select distinct client_id as k, name as v from clients");

$g->select_command = "SELECT id, invdate, invheader.client_id, amount, note FROM invheader
INNER JOIN clients on clients.client_id = invheader.client_id
";

Massimo Gagliardi answered 8 years ago

Hi Abu,
I changed many things from my last message and now all seems work fine !
This is, most likely, a my mistake
Regards

Your Answer

0 + 6 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?