Editor Select Value Missing on Edit

Editor Select Value Missing on Edit

vincmeistervincmeister Posts: 136Questions: 36Answers: 4

Hi Allan,
My editor's select value missing on Edit. I suspected this happened because condition (where) applied on option.
My php

Field::inst( 'threalisasi.id_blok_kavling' )
 ->options( Options::inst()
 ->table( 'mhkavling' )
 ->value( 'id' )
 ->label( 'nomorblokkavling' )
 ->where( function ($q) {
    $q->where( 'is_sold', 0 );
    }) 
 ),
Field::inst( 'mhkavling.nomorblokkavling' ),

My js

{
  label: "No Blok Kavling:",
  name: "threalisasi.id_blok_kavling",
  type: "select2"
}

if i remove the where, Editor show the value of No Blok Kavling on edit
I try to put this code, still not working, but the id_blok_kavling shown on console

edtKavling.on('initEdit', function( e, node, data, items, type ){
  id_blok_kavling = data.threalisasi.id_blok_kavling;
  console.log(id_blok_kavling);
  edtKavling.field('threalisasi.id_blok_kavling').val(id_blok_kavling);
});

please advise, thank you

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    If the value isn't shown as selected on edit, it suggests that the value of the threalisasi.id_blok_kavling field isn't available in the list of options made available to that field.

    I'd need a link to a test case showing the issue to be able to confirm if that is the case please.

    Thanks,
    Allan

This discussion has been closed.