selector in datatable editor from ajax json response

selector in datatable editor from ajax json response

tatevikztatevikz Posts: 12Questions: 3Answers: 0

Hi.
I have the datatable editor, which has selector as field.
And the selector need to be generated dynamically from ajax json response

So I have the selector as field:

{
            label: "Color Code:",
            name: "products.color_code",
            type:  "select"
        },

I'm getting the selector options using depedent()

editor.dependent('products.color_code', function(val,data,callback){
    $.ajax ( {
        url         : 'ajax/update_color_code.php',
        data        : {
                    "cat_id"        : editor.field('categories_description.categories_id').val()
                    },
        type        : 'post',
        dataType    : 'json',
        success     : function ( json ) {
        }
    });
}) ;

And here is my json:

"options: ": [["85.0000", "blue"], ["125.0000", "orange"], ["1111.0000", "red"], ["75.0000", "yellow"]] 

Could you please help me to understand how to set the json value as selector's option.

Thanks in advance

Answers

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    This appears to be a duplicate of your question here which I've answered there. Please don't post duplicates :).

    Allan

This discussion has been closed.