How to populate option based on condition

How to populate option based on condition

maengkommaengkom Posts: 1Questions: 1Answers: 0

Hello,

Assume datatables created and display correctly. And some fields can be edited using inline editing. I don't know how to populate options based on data on warehouse. For example when row with warehouse id = 1 then options for location is location[1]. If warehouse id = 2, then options set for location[2].

    editor = new $.fn.dataTable.Editor({
        table: "#data-table",
        ajax: '{!! route('maintenance.sparepart.balance.item', ['id' => $data->id]) !!}',
        fields: [
            { name: "warehouse_id", type: 'select', options: warehouse },
            { name: "location_id", type: 'select', options: location[1] },
            { name: "price" },
            { name: "quantity" },
            { name: "remark" }
        ],
        formOptions: { inline: { onBlur: 'submit' } }
    });
This discussion has been closed.