I have selector in a form. This selector has default data, but I need to show some data depending on who is accessing this form. The problem is when someone is to access it the first time, the selector doesn't refresh but it refreshes correctly when it is accessed the second time.

How I can do it to refresh on the first time?

I'm using selectpicker with jQuery and I get data through JSON

 var _loadProjectSelector = function (data, valProjecte) {
        var toAppend = '<option disabled selected="true" value=""> -- Selecciona un Proyecto -- </option>';
        $.each(data, function (id, value) {
            toAppend += '<option data-subtext="' + value.P_codi + '" value="' + value.P_codi + '">' + value.P_nom + '</option>';                
            Config: {
                autocomplete: true,
                size: 14
        $(juniper.specialProjects.intranet.selectors.MODAL.INCIDENTPROJECT_SELECT).selectpicker('val', valProjecte);
        return true            

var _getProjectSelector = function (dataProjecte, valprojecte) {          
            url: window.baseUrl + '/incident/ajax/regularIncidentManagement.ashx',
            async: true,
            data: dataProjecte,
            dataType: "json",
            type: 'POST',
            success: function (result) {                    
                if (result.StatusOk) {
                    if (_loadProjectSelector(result.Result, valprojecte) == true) {                       

                } else {
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                juniper.specialProjects.intranet.Notifications.showErrorNotification("Se ha producido un error");

I hope that the change is reflected in the first instance

Related posts

Recent Viewed