Tips for creating read-only checkboxes with multipledropdown.js in Angular.js

I am trying to make all checkboxes in a multiple dropdown list readonly using Angular.js with the multipledropdown.js plugin. My code snippet is as follows:

<div class="col-md-6" ng-show="sub_sub_menu">
<div class="input-group bmargindiv1 col-md-12">
<span class="input-group-addon ndrftextwidth text-right oditek-form" style="width:180px">Sub Sub Menu:</span>
<div ng-dropdown-multiselect="" options="example17data" selected-model="example17model" checkboxes="true" extra-settings="example17settings" class="form-control oditek-form" disabled=true></div>
    </div>
</div>

var url3='../service/admin/user/group.php';
        var method3='POST';
        var data3=$.param({'action':'getAllSubSubMenuData','sub_id':$scope.smenu.value,'id':$scope.mmenu.value});
        $scope.example17data=[];
        DataService.connectToServerSideScript(method3,url3,data3)
        .then(function(response) {
            //console.log('state',response);
            if (response.length >0) {
                angular.forEach(response,function(obj){
                    var cdata={'label':obj.menu,'id':obj.id};
                    $scope.example17data.push(cdata);
                })
                angular.forEach(response,function(obj){
                    var data1={'id':parseInt(obj.id)};
                    $scope.example17model.push(data1);
                })
                $scope.sub_menu=true;
                $scope.sub_sub_menu=true;
            }else{
                $scope.sub_menu=true;
                $scope.sub_sub_menu=false;
            }
        },function(error) {

        })

In this code snippet, I have implemented a multiple dropdown checkbox list where all checkboxes are initially checked. However, I am looking to make these checkboxes readonly to prevent any changes.

Answer №1

In order to make the options read-only, you must disable them by adding the disabled property to your object. Here is an example for you to try:

var data = {'label': obj.menu, 'id': obj.id, disabled: true};

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Node.js error: exceeding parameter limit encountered during bulk data upload

I've been tasked with uploading user data in bulk via a CSV file. I'm utilizing nodejs along with the express framework. Everything works smoothly when I upload a CSV file with 60 to 70 rows, but once it exceeds 70 rows, I start encountering a se ...

Identifying when a fetch operation has completed in vue.js can be accomplished by utilizing promises

Currently, I am facing a dilemma in my Vue.js application. I am making an API call within the created() hook, but there are certain tasks that I need to trigger only after the API call has been completed. The issue is that this API call usually takes aroun ...

An error has occurred in React with a nested JSON object, suggesting that it may actually

I encountered an interesting error with my React file using Axios. While the data retrieval from my post works fine, I am facing a problem when trying to display all posts on one page. Despite my efforts to find a solution, I have not been successful. Bel ...

Calculate the total width of all images

I'm on a mission to calculate the total width of all images. Despite my attempts to store image widths in an array for easy summing, I seem to be facing some challenges. It feels like there's a straightforward solution waiting to be discovered - ...

The jQuery change function appears to be functioning properly, but it is not producing any results

I am facing an issue with my jQuery code that rebuilds a dropdownlist based on the radio buttons selected. Although the code seems correct and the method works properly, the dropdownlist items do not update as expected. Can anyone provide some insight or i ...

The concept of AngularJS bi-directional binding

Can a two-way binding be created between the parent scope and my directive's isolated scope without using my directive's attributes? The '=' sign establishes a two-way binding, but not in a direct way: it does not take the specified va ...

Leveraging jQuery within Node.js

Greetings, I am a newcomer here and I hope that my message is clear. My current challenge involves trying to incorporate jQuery into node.js, but unfortunately, all my efforts have ended in failure. I have spent hours attempting to resolve this issue to no ...

Strategies for capturing a 404 error in an Express router

Trying to capture the 404 page not found error in an express router. Using a simple example : const express = require('express'); const app = express(); const router = express.Router(); // ROUTER MID BEFORE router.use((req, res, next) => { ...

Converting an array of objects into a dictionary using TypeScript

I'm attempting to convert an array of objects into a dictionary using TypeScript. Below is the code I have written: let data = [ {id: 1, country: 'Germany', population: 83623528}, {id: 2, country: 'Austria', population: 897555 ...

Create a unique type in Typescript that represents a file name with its corresponding extension

Is there a way for me to specify the type of a filename field in my object? The file name will consist of a string representing the name of the uploaded file along with its extension. For instance: { icon: "my_icon.svg" } I am looking for a ...

Open the overflow div within a table data cell

My goal is to create a drag-and-drop schedule tool similar to Fullcalendar. I have decided to use a table layout with a rectangular div inside each TD cell to represent tasks. <table onDragEnd={dragend}> <tr> <th>0</th> ...

"Troubleshooting Problem with JSON Encoding in PHP and Parsing with getJSON in

Apologies if this sounds like yet another discussion on the topic, but I've been struggling for hours without finding a solution. I'm attempting to retrieve data from a MySQL database, generate a JSON using PHP, and then parse this JSON in JavaS ...

Injecting live data into an input field within a table using Angular 4

Trying to create a dynamic row table with input fields in all cells. The loaded data is static, and I'm facing issues adding more data in the view. However, the functionality to add and delete rows is working fine. I have experimented with ngModel and ...

For the past two days, there has been an ongoing issue that I just can't seem to figure out when running npm start

After multiple failed attempts, I have exhausted all troubleshooting steps including executing npm clear cache --force, deleting node_modules/ and package-lock.json, followed by running npm install, npm build, and eventually npm run dev. The errors encoun ...

Struggling to display an array fetched from $http in ng-repeat using AngularJS - it only shows individual items like [0]

I'm brand new to working with Angular (so please forgive any incorrect terminology), and I'm attempting to retrieve data from the Stack Overflow API. I am able to fetch data for individual items, but when I try to display the top 10 questions usi ...

Guide to showing remote html page in a modal window using Angular JS

Sample Bootstrap Code: <a class="btn btn-lg btn-default" data-toggle="modal" data-target="#remoteModal" href="remote-page.html">Open modal window</a> Is it possible to achieve a similar functionality using Angular Bootstrap or ...

Storing a multi-dimensional array in PHP efficiently

My PHP data consists of user limits: $userLimit = array( "default" => array( "playlistLimit" => 1, "mediaLimit" => 2, ), "editor" => array( "playlist ...

FAB Toolbar - Stuck halfway and won't fully open

I have implemented a FAB Toolbar component in the lower right corner of the screen. It is overlaying the scrollable content (represented by the <div> here). The hovering behavior over the content seems to be working correctly, and the positioning app ...

Second attempt at initiating Ajax request fails

My ajax/php structure works perfectly when selecting one image. However, if I click on "selecteer" to perform the same code for the second time, no images are displayed. The "ajax" page loads correctly each time. Here's the setup: Article page: Disp ...

Unable to reset HighCharts Speedometer value to zero

I am currently experimenting with implementing the highcharts speedometer. The goal is to simulate a connection meter - when there is a good connection, the meter should display values between 30 and 100. If the connection result from an Ajax call is any ...