Numerous Kendo windows are layered on top of each other, yet the text divisions within them remain distinct

I am currently working on a project that involves laying out multiple Kendo windows in rows. Specifically, I need to display 4 windows in each row and have them shift left when closed.

My framework of choice is Bootstrap 3.

Everything works as expected with 6 divs arranged in the same manner. The delete button in my code removes one div at a time and causes the others to shift accordingly.

However, I've encountered issues with the Window feature inside the divs:

1) The 5th window overlaps the 1st window instead of being placed in the second row.

2) When closing a window using the close button, the windows to the right do not shift as intended.

Upon inspection, I noticed that the actual window control is created at the bottom of the HTML with the class k-widget k-window. The div in the row class simply contains the jQuery function for displaying the Window.

When I close a window, it gets destroyed but the positions of the other windows do not change, causing them to stay in place instead of shifting left.

Here's a snippet of the code:

<div class="row" id="partialWindows1">
    <div id="hello" class="col-md-3">@(Html.Kendo().Window()
.Name("win1")
    .Title("Window1")
    .Content(@<text>
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .Events(e=> e.Deactivate("win_deac"))
          )
</div>
    <!-- Other window definitions here -->
</div>

<br/>
<br/>

<div id="divDivs" class="row" style="margin-top: 100px">
    <div class="col-md-3">div1</div>
    <div class="col-md-3">div2</div>
    <div class="col-md-3">div3</div>
    <div class="col-md-3">div4</div>
    <div class="col-md-3">div5</div>
    <div class="col-md-3">div6</div>
</div>

<button id="btnDelete">Delete</button>

<script>
    $(document).ready(function () {
        $('#btnDelete').on('click', function () {
            if ($('#divDivs div').length > 0)
                $('#divDivs div')[0].remove();
        });
    });

    function win_deac() {
        this.destroy();
    }
</script>

If anyone has suggestions on how to resolve these issues, I would greatly appreciate it. Thank you for your assistance!

Answer №1

After discovering the appendTo method on the Window widget, I was able to solve this problem efficiently. I also implemented a smooth animation for window deletion.

<div class="row">
    <div id="div1" class="col-md-3 atl-win">    @(Html.Kendo().Window()
.Name("win1")
    .Title("Window1")
    .Content(@<text>win1
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .AppendTo("#div1")
    .Events(e=> e.Deactivate("win_deac").Close("win_close"))
          )
</div>
    <div id="div2" class="col-md-3 atl-win">@(Html.Kendo().Window()
.Name("win2")
    .Title("Window2")
    .Content(@<text>win2
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .AppendTo("#div2")
    .Events(e=> e.Deactivate("win_deac").Close("win_close"))
          )</div>
    <div id="div3" class="col-md-3 atl-win">@(Html.Kendo().Window()
.Name("win3")
    .Title("Window3")
    .Content(@<text>win3
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .AppendTo("#div3")
    .Events(e=> e.Deactivate("win_deac").Close("win_close"))
          )</div>
    <div id="div4" class="col-md-3 atl-win">@(Html.Kendo().Window()
.Name("win4")
    .Title("Window4")
    .Content(@<text>win4
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .AppendTo("#div4")
    .Events(e=> e.Deactivate("win_deac").Close("win_close"))
          )</div>
    <div id="div5" class="col-md-3 atl-win">@(Html.Kendo().Window()
.Name("win5")
    .Title("Window5")
    .Content(@<text>win5
    </text>)
    .Draggable()
    .Width(150)
    .Height(60)
    .AppendTo("#div5")
    .Events(e=> e.Deactivate("win_deac").Close("win_close"))
          )</div>
</div>

<br/>
<br/>

<div id="divDivs" class="row" style="margin-top: 100px">
    <div class="col-md-3">div1</div>
    <div class="col-md-3">div2</div>
    <div class="col-md-3">div3</div>
    <div class="col-md-3">div4</div>
    <div class="col-md-3">div5</div>
    <div class="col-md-3">div6</div>
</div>

<button id="btnDelete">Delete</button>

<script>
    $(document).ready(function () {
        $('#btnDelete').on('click', function () {
            if ($('#divDivs div').length > 0)
                $('#divDivs div')[0].remove();
        });
    });

    function win_deac() {
        this.destroy();
    }

    function win_close(e) {
        var $divRem = $(e.sender.options.appendTo);
        $divRem.hide(1000, function () { $divRem.remove(); });
    }
</script>

I believe this solution will be beneficial to others facing similar challenges.

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

Basic color scheme

I'm attempting to change the background color behind a partially transparent .png div. The CSS class that modifies the div is ".alert". Manually editing the .alert class background color works perfectly, and now I want to automate this on a 1-second c ...

Prevent hyperlink redirection based on specific condition using jQuery

Managing a large number of files on my website and looking to implement a download limit for each user. The download link appears as follows: <a class="btn btn-primary" id="download" href="<?php echo $content_url;?>" onclick=”var that=this;_ ...

Toggle the visibility of the next unordered list using jQuery

I am experiencing a challenge with toggling the visibility of a ul element in this example. My jQuery script is functioning properly on all elements except for the ul element. $('.dropdown-toggle').on('click', function(event) { $(t ...

Utilizing SVG within Sproutcore allows for seamless access to DOM nodes and the ability to effortlessly bind Sproutcore events directly to the DOM

Exploring Sproutcore, I am delving into the world of SVG (Standard Vector Graphics) integration within the app. The goal is to utilize a canvas for drawing elements like lines, boxes, and images, all of which SVG offers. My approach involved incorporating ...

What is the correct placement for $.validator.setDefaults({ onkeyup: false }) in order to deactivate MVC3 onKeyup for the Remote attribute?

After coming across various solutions on how to disable the onKeyup feature of MVC3 Remote Validator, I noticed that many suggest using the following code: $.validator.setDefaults({ onkeyup: false }); However, I'm in a dilemma about where to place t ...

Is there a way to make my red div switch its background color from red to green when I press the swap button?

How can I make the red div change its background color to toggle between red and green when I click on the swap button in the following code? $(document).ready(onReady); var numberOfClicks = 0; function onReady() { console.log('inside on ready ...

The modal box should adjust its height to perfectly accommodate the content within

I'm in the process of developing a straightforward modal (popup) window, using as few lines of code as possible... just the basics. The modal has a maximum width of 650px and its height adjusts to fit the content. In case the content exceeds the avai ...

A Guide on Adding Excel-Like Filtering Functionality to AngularJS

I am struggling to implement a simple Excel-like filter for a table using AngularJS (v.1). I have shared my code snippet below and would appreciate any help to show filtered data in the table after checking a checkbox and clicking on the OK button. I have ...

The jQuery autocomplete feature presents all choices regardless of what is typed into the input field

I'm currently working on a jQuery script that retrieves a JSON response and creates individual "player" objects based on the data received. These player objects are then added to the availablePlayers array, which serves as the data source for the aut ...

Unusual case of missing lines while reading a file using readline.createInterface()

const readline = require('readline') const fs = require('fs/promises'); (async function() { await fs.writeFile('/tmp/input.txt', [...Array(100000).keys()].join('\n')) await fs.writeFile('/tmp/other.tx ...

Tips for overcoming indentation issues using ESLint?

Ever since I started using Vue 3 with ESlint, I've been encountering a new problem. Whenever I try to run my code, I am bombarded with numerous errors like: --fix option.

I'm looking for ways to disable this troublesome feature of ESlint. H ...

Prevent the unwanted 100 Continue behavior in Ajax requests

My Javascript application sends out large POST requests to a backend server. Due to the fact that we need all requests directed to our non-public endpoint and the load balancer/proxies struggle with the Expect: 100-Continue header, I am seeking a way to pr ...

Gliding along a div and concealing it out of view, making it seem like it has disappeared

I attempted to slide down the ".preloader" div after a 2-second delay using JQUERY, but I couldn't get it to work as expected. I didn't want to use a toggle button for this effect. I also experimented with creating an animation using @keyframes, ...

Divide the page vertically. On the left side, feature an eye-catching image, while on the right side,

While I have a good understanding of bootstrap 5, I am currently working on a project that requires me to split the page down the center. However, I also need to incorporate a container in the middle that sets a boundary for the text so it doesn't exp ...

Which specific file is being requested when a forward slash (/) is placed immediately after the website URL?

Is it just me being clueless, or is there something unusual about this URL format? I've come across URLs like http://www.example.com/?p=1 quite often and I'm curious to know what exactly is being accessed by it. I usually use URLs such as http:// ...

Insert HTML content into an iframe with a callback function

We are receiving information from the backend server and need to transfer it to an iframe. In order to accurately set the height of the iframe to match the content, we must wait for the content to be loaded into the iframe. However, this process may not ha ...

Error message: Cannot establish the attribute 'next' on the string '/:id'

I encountered an error while trying to develop an API for a travel company. The error message "TypeError: Cannot create property 'next' on string '/:id'" keeps popping up, even though all the necessary functions are already created. con ...

Tips on customizing the appearance of two Material-UI Sliders across separate components

Looking to customize two sliders, each within their own react component. Slider in the first component const customizedThemeSlider1 = createTheme({ overrides:{ MuiSlider: { thumb:{ color: "#4442a9", marg ...

Issue with Mobile Touch Screen Preventing Vertical Scrolling

Currently experiencing difficulties with a div element that is not allowing touch and vertical scroll on mobile devices. Although scrolling works fine with the mouse wheel or arrow keys, it does not respond to touch. Have tested this on various devices and ...

Utilizing Angular to automatically extract keys from nested objects in a response

In my Angular application, I am facing a challenge with accessing nested responses from the server. The data structure contains multiple responses within one parent object, and I am struggling to dig deeper into it. Here is the code snippet I have so far: ...