Tree grid and lookup column

QuestionsTree grid and lookup column
Alessandro asked 2 years ago

Hi Abu,

I have a tree grid whit a lookup column(id) on the same table of tree grid.
After add new record, in grid the new record is diplayed but there is not 
in drop down field of Add form (I use for add child to father record).
Can you help me?
Thanks in advance
2 Answers
Alessandro answered 2 years ago

Hi Abu

I solved the problem in this way:
in $grid["edit_options"]["beforeShowForm"] and 
$grid["add option_options"]["beforeShowForm"] I call refreshlookup()
function refreshlookup() {
    alldata = $('#list1').jqGrid('getGridParam', 'data');
    $('#idfather').html(); //clear list dropdown in form
    newlistval = '';
    for (i = 0; i < alldata.length; i++) {
        id = alldata[i]['_id_'];
        title = alldata[i]['chaptertitle'];
        idfather= $('#list1').getRowData($('#list1').getGridParam('selrow')).idfather;
        strselected = '';
        if(idfather===id) strselected = 'selected';
        newlistval += '<option role="option" value="' + id + '" '+strselected+'>' + title + '</option>';
    }
    $('#idfather').html(newlistval);
}

Alessandro

Abu Ghufran Staff answered 2 years ago

Nice work, Thanks for sharing.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

6 + 5 =

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?