No server side select data with Always visible editing panel

No server side select data with Always visible editing panel

INTONEINTONE Posts: 153Questions: 58Answers: 6
edited January 2018 in Editor

I am having an issue where when I use the Always visible editing panel feature found here: https://datatables.net/blog/2017-06-30 with server side :smile:
//server

  Field::inst( 'applicationForm.branchID' )
              ->options( Options::inst()
              ->table( 'branches' )
              ->value( 'name' )
              ->label( 'name' ))
              ->validator( 'Validate::dbValues' )

//editor

 {
           label:'Branch',
            name:'applicationForm.branchID',
            type:'select' 
                    
 }

The interesting thing is that when I switch back to the standard modal method I see the data in the select list. If I make the select list static by passing an array of values to the option parameter in editor I also see the select. However that method will not suit my needs at this time. Is there a fix for this?

Answers

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    I found a simple fix doing:


    { label:'Branch', name:'applicationForm.branchID', type:'select' }, ........ editor.dependent('applicationForm.branchID', function(val,data,callback){ $.ajax ( { url : 'application/includes/php/getBranchData.php', data : { "_" : $.now() }, type : 'post', dataType : 'json', success : function ( json ) { console.log(json) editor.field('applicationForm.branchID').update(json); // editor.field('work.areaID').val(json.selected) //console.log("area: "+json.selected); } }); });

    I would have preferred the other way seeing it is cleaner.

  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin

    I'm not actually clear what the issue is I'm afraid. Does it not populate the select from the configuration options defined in the PHP? Could you give me a link to a page showing the issue please?

    Allan

  • INTONEINTONE Posts: 153Questions: 58Answers: 6

    Yes, that is the issue. I am afraid there could be other issues at play, as I am embedding the form in a joomla website using a joomla plugin. For the moment the issue is resolved using the fix I used but for future work not using this joomla setup, I will try the original method.

This discussion has been closed.