optionCaption disable in ko.js?

0

How can I make my optionsCaption from a drop-down list disabled?

my html is this:

 <div class=" col-sm-3 col-md-3 col-lg-3 col-xs-3"> 
           <label for="comment">Tipo de analisis:</label>
            <div class="input-group">
                <span class="input-group-addon"><i class="glyphicon glyphicon-list"></i></span>
                <select class="form-control Select2"  id="selTipoAnalisis"  data-bind="options: TodosAnalisis , value: Analisis, event: { change: function () { vm.cargarComboAnalisis() } }, optionsValue: 'CodigoAnalisis', optionsText: 'NombreAnalisis', optionsCaption: '--Seleccione un tipo Análisis--'">
                </select>
            </div>              
        </div>

and the part of the js that loads the options, after obtaining a response from an ajax call is the following:

 resp.success(function (data) {
        data = $.parseJSON(data.d);

        $.each(data.Table, function (i, j) {

            self.TodosAnalisis.push({
                NombreAnalisis: j.C000DescDimension,
                CodigoAnalisis: j.C000CodDimension
            });

        });
    });

Every time an apcion is selected in this select, the option of another select that has the following html part will change:

<div class=" col-sm-5 col-md-5 col-lg-5 col-xs-5"> 
           <label for="comment">Analisis:</label> 
            <div class="input-group"> 
                 <span class="input-group-addon"><i class="glyphicon glyphicon-list-alt"></i></span>
                 <select id="selAnalisis" class="form-control Select2" multiple="multiple" data-bind="options: varAnalisis, value: VariosAnalisis, optionsValue: 'CodigoAnalisis', optionsText: 'NombreAnalisis'"  placeholder="--Seleccionar un Análisis--"> 
                 </select>               
            </div>
        </div>

and part js of this last selection is the following:

 resp.success(function (data) {

        data = $.parseJSON(data.d);
        $.each(data.Table, function (i, j) {

            self.varAnalisis.push({
                NombreAnalisis: j.C019NomMaestro,
                CodigoAnalisis: j.C019CodMaestro
            });
        });
    });

They can help me, I need the option that says '--Select a type Analysis--' ... that would be the opctioCaption always be disabled, I am a newbie in web development and I do not know how to do it! thank you very much!

    
asked by Luis Miguel Viana 21.05.2018 в 15:36
source

0 answers