Modifying the maxHeight property of the angular-gantt component does not yield any noticeable changes

I am currently experiencing issues with dynamically changing the height using the angular-gantt library. Despite setting a new value for the maxHeight attribute in the controller, it does not reflect on the view as expected. I have seen this feature work in the demo app (Angular Gantt demo - by clicking Layout->Height). Am I overlooking something here? Any guidance would be appreciated.

Below is a snippet of my code:

<!DOCTYPE html>
<html>
  <head>
    <link rel="stylesheet" href="angular-gantt.css" />
    <script src="angular.js"></script>
    <script src="moment.js"></script>
    <script src="angular-moment.js"></script>
    <script src="angular-gantt.js"></script>
  </head>
  <body ng-app="myApp">
    <script>
        var myApp = angular.module('myApp', ['gantt']);
        myApp.controller('Ctrl', ['$scope','$window', function($scope, $window){

          $scope.cutSomeHeight = function() {
            $scope.options.maxHeight -= 50;
          }

          $scope.options = {
            maxHeight: 500,
            data: [],
            viewScale: "1 month",
            columnWidth: 100
          }

          for (var i=0; i<100; i++){
            $scope.options.data.push({name: 'Task' + i, tasks: [{name: i, from: moment("2015-01-01","YYYY-MM-DD").add(i % 12, 'months'), to: moment("2015-06-01","YYYY-MM-DD").add(i % 12, 'months')}]})
          }
       }]);
    </script>
    <div ng-controller="Ctrl">
      <button ng-click="cutSomeHeight()">Cut</button>
      <div gantt options="options"></div>
    </div>
  </body>
</html>

Answer №1

After some investigation, I discovered that everything functions properly if the max-height attribute is placed within the gantt div. It seems like there was an issue with linking that variable to the gantt's scope, as it was only relying on the options attribute.

<div gantt options="options" max-height="options.maxHeight"></div>

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

guidelines for rendering a Vue component within a Vue file using vue-server-renderer

Starting the rendering component with vuejs is my goal. I currently have a basic node server set up. const Vue = require('vue'); const server = require('express')(); const template = require('fs').readFileSync('index. ...

What is the best way to retrieve the value of an nth column in a table using

Is there a way to retrieve the value of a specific column in a table? For example, I want to get the value of the 2nd column. I have no trouble getting the first one using this method - it works perfectly fine. However, when I try to retrieve the value of ...

Storing AngularJS route components in the cache for optimal performance (keep-alive)

I'm looking for a way to cache the state of a component A so that it doesn't re-render every time I navigate away and back to it. This component also makes a slow API call in its constructor. I want to maintain this initial state throughout the u ...

How can you retrieve the current user in express.js when incorporating socket.io?

I have a web app using the express framework and socket.io for real-time chat. I am trying to get the current user's username and create a room with them in it, but I am struggling to retrieve the user info when socket.on('connection') is ca ...

An abundance of AJAX requests inundating the server

While working on a straightforward AJAX request, I encountered an issue where the server is sending back 3 responses instead of just one (you can see the example in the attached image). Could someone provide insight into why this might be happening? var ...

What is the top JavaScript library for compressing and adding files for transfer to an API?

In the process of developing a Vue.js application, I am facing the task of zipping data into files, adding them to a zip folder, and then sending the zip folder to an API. After researching, I found two options - Zip and JSZip, but I'm uncertain about ...

What is the best way to establish a maximum value for variable inputs?

In my Vue form, I have dynamic inputs for issuing shares to shareholders. The user first registers the total amount of shares in the form, then starts issuing this total amount partially by adding dynamic inputs as needed. Finally, the form is submitted. M ...

Attempting to create a single function that can be utilized with numerous divs that share the same class in jQuery

Currently, I am working on creating a basic jquery gallery viewer. In my code, I have the following structure: <div class="photoset"> <img /> <img /> </div> <div class="photoset"> <img /> <img /> <i ...

Looking to extract, interpret, and display PDF documents using React?

I'm working on displaying a PDF file from an external URL. My goal is to extract text from the PDF for analysis, and then present a specific section of a page to users in my React application. This will involve cropping the content using coordinates o ...

What is the best way to access the watchExpression within the listener of the $watch function?

Is there a way to access the watchExpression inside the listener function? My goal is to extract parameters from the watchExpression. $watch(watchExpression, [listener], [objectEquality]); ...

The functionality of $viewContentLoading appears to be malfunctioning

Before the content is loaded, I'm attempting to log a value. I am using $viewContentLoading within the init function, but the value is not being logged. Can anyone help me identify the issue with my code? var app = angular.module('plunker&apos ...

Positioning a div on the right side of its parent div

Hi there! I'm currently working on a small navbar that has two sections: the left section with an arrow icon and the right section with two icons - an envelope and an exclamation triangle. I've been trying to position the right section in the top ...

Utilizing Angular2 Guard to Ensure False IdentityServer4 OIDC Security

After successfully authenticating a user and redirecting them back to the main site, the following code runs: <script src="https://cdnjs.cloudflare.com/ajax/libs/oidc-client/1.2.2/oidc-client.min.js"></script> <h1 id="waiting">Waiting... ...

The Magic of Jasmine's toMatch Method and the Power of Parentheses

Have you observed that when using Jasmine Expect with toMatch, it fails if the string being matched contains a (? If so, what steps did you take to address this issue? For example: This statement fails or returns "False" instead of "True": expect("test ...

5 Ways to Show Yes/No Instead of True/False in AngularJS

Currently, I am utilizing the cellTemplate to showcase the information on the grid. Now, I need to present this data on ng-grid, where one column contains data with true or false values. I would like it to display "Yes" for true and "No" for false. Can s ...

Logging in using email, phone number, or username on Node.js platform

How can I implement a login system in node.js and MongoDB that allows users to log in with their email, phone number, or username along with a password? Similar to the login functionality seen on Instagram, users should be able to enter their email or u ...

Display more/hide less form using div elements in a NextJS project

Looking to create a hidden block of amenities on my hotel website that can be expanded and collapsed with buttons in NextJS using tailwind-css. How can I achieve this functionality? Example 1: https://i.stack.imgur.com/BbrUj.png Example-2: https://i.stac ...

I did not anticipate the React setState function to behave in the manner it did

While working on form validation for my page, I came across a tutorial showcasing a validation method that seems to be functioning correctly. However, there is one aspect that I am struggling to grasp. The tutorial suggests declaring a variable before the ...

What is the best location to insert <script src=...></script> in an angular-fullstack-generator project?

I'm having trouble integrating mobile-angular-ui into my angular-fullstack-generator project. Despite receiving a proper 200 response in the network tab, I keep encountering an "Uncaught SyntaxError: Unexpected token <" error when trying to includ ...

Is it beneficial to dockerize an AngularJS + nginx codebase?

Currently, I am working on an AngularJS front-end project that is hosted on nginx and communicates with a back-end Java server (which is not part of this codebase). Each time I need to install the package, I run the following commands: # ensure that node, ...