Search the list inside data

Search the list inside data

bearV1bearV1 Posts: 2Questions: 1Answers: 0

The question is, how can i search the data, when the td is select list ?

here is my code

                        {
                            mData: 'Status',
                            mRender: function (data, type, result) {

                                var $select = $("<select></select>", {
                                }), $value = [{
                                    text: 'Yes',
                                    value: 0,
                                }, {
                                    text: 'No',
                                    value: 1,
                                }];

                                $($value).each(function (i, val) {
                                    var option = $('<option></option>', {
                                        'text': val.text,
                                        'value': val.value,
                                        'selected': data == val.value ? 'selected' : false
                                    });

                                    $select.append(option);
                                });
                                return $select.prop('outerHTML');
                            }
                        }

This question has an accepted answers - jump to answer

Answers

  • bearV1bearV1 Posts: 2Questions: 1Answers: 0
    edited January 2019

    Any solution better than this ?
    ```
    return $select.prop('outerHTML') + <span hidden>${data}</span>;

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    Hi @bearV1 ,

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

This discussion has been closed.