Stylize the selected item in a kendoui listview

I am utilizing a kendoui listview to showcase various signatures in an ASP.NET MVC 5 project.

My goal is for the listview to allow selection and exhibit data based on a predefined template.

Everything is functioning properly, except for an unwanted margin that appears when selecting items, and I'm unsure how to remove it!

Here's the template I'm using:

<script type="text/x-kendo-template" id="sTemplate">
    <div class="signature">
        <img src="data:image/png;base64,${Base64Image}" />
        <h3>#:SigneeName#</h3>
        <h3>#= kendo.toString(kendo.parseDate(TimeStamp), "dd/MM/yyyy HH:mm")#</h3>
        <p></p>
    </div>
</script>

And here is my CSS style:

<style>
    #listView {
        padding: 5px;                    
        margin-bottom: 5px;
        font: inherit;
    }

    .signature {
        float: left;
        position: relative;
        width: 176px;
        height: 160px;
        margin: 5px 5px 5px 0;
        padding: 5px;                    
    }

    .signature img {
        width: 175px;
        height: 130px;
    }

    .signature h3 {
        margin: 0;
        padding: 3px;
        max-width: 156px;
        overflow: hidden;
        line-height: 1em;
        font-size: .9em;
        font-weight: normal;
        text-align: center;
        color: BLACK;
    }

    .signature:hover p {
        visibility: visible;
        position: absolute;
        width: 185px;
        height: 170px;
        top: 0;
        margin: 0;
        padding: 0;
        line-height: 170px;
        vertical-align: middle;
        text-align: center;
        color: #fff;
        background-color: rgba(200, 200, 200, 0.5);
        transition: background .2s linear, color .2s linear;
        -moz-transition: background .2s linear, color .2s linear;
        -webkit-transition: background .2s linear, color .2s linear;
        -o-transition: background .2s linear, color .2s linear;
    }

    .k-listview:after {
        content: ".";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;
    }
</style>

The displayed items are exactly as intended:

https://i.sstatic.net/Mmr46.png

However, when I select an item, I want to eliminate this margin:

https://i.sstatic.net/3PhYW.png

You can view a complete demo here:

Any assistance with resolving this issue would be greatly appreciated.

Answer №1

When an item is chosen, Kendo will append the k-state-selected class to the main element in your template. To customize this selection, you can utilize a CSS selector like the one below:

<style>
    .signature.k-state-selected {
        padding: 10px;                  
    }
</style>

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

Unable to create a responsive design for this box

I've been attempting to place text and a button inside a box, but I'm encountering issues with fitting them on medium and small screens. So far, the methods I've tried have not been successful. Below is the code I am currently using: * { ...

When updating the content of a div with refreshed data using jQuery, it may result in displaying

Currently, I am utilizing a jQuery calendar plugin in my project. You can view its demo here. The issue arises when I attempt to refresh the data by clicking on the refresh button, resulting in duplicate values. To illustrate this problem, I have provided ...

How do you determine the length of an array of arrays using jQuery if it is 'undefined'?

Looking at the array structure below: mdarray = { '0001':{address:'add1',title:'title1'}, '0002':{address:'add2',title:'title2'}, '0003':{address:'add3',title:'titl ...

Executing jQuery on a fixed HTML document via Bash

Looking to create a straightforward script that can check a webpage for a specific value: $("a#infgHeader").text() == "Delivered"; I'm interested in automating this from a Bash script to run periodically. I'm open to exploring Python as well. T ...

The field for identity datetime must contain a value and cannot be left null

I recently added a custom ApplicationUser class that extends IdentityUser in my project. This class includes additional fields that correspond to columns in the AspNetUsers table in my SQL Server database. For example, in SQL the column may be defined as M ...

Creating a personalized inline MailChimp form

Check out this Code Pen link. My company's website has an opt-in form but it's not aligning properly. I want the name, email, and subscribe fields to be on the same line. Any suggestions? I suspect there might be a conflict with bootstrap. HT ...

Managing my 401 HTTP response in ASP.NET MVC for both traditional and Ajax requests: A comprehensive guide

In my asp.net mvc 4 web application, I have created a custom authorization attribute which checks user permissions. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] public class CheckUserPerm ...

How can I apply a unique CSS class to specific rows within an h:dataTable?

I am looking to apply unique CSS classes to certain rows within my <h:dataTable>. Is it possible to manipulate and style the individual table rows in a customized manner? ...

Select2 in Bootstrap does not trigger the select event when pasting until a word has been typed

One issue I encountered while using bootstrap select2 v4.* on my site (Yii 2.x) is that the event select2:select does not fire when text is pasted with ctrl+v until some text is manually typed. Once some text is entered, the event works as expected. What ...

Tips for utilizing the TinyMCE special button and personalized dialog box for inserting content into your website

By utilizing the TinyMCE editor, I successfully added a custom button to its toolbar and connected it to a Flickr account. This allows a specialized dialog box to display with various image options. The goal is for users to click on an image within the di ...

Incorporating Angular into the script code of the extension content

I am looking to customize text fields on a website using a chrome-extension. However, the website is built with Angular, so I need to modify the text fields using Angular code. To incorporate Angular in my extension's scope, I am attempting to declar ...

You can tab through form input boxes on an Adobe Muse website, but they cannot be clicked

Lately, I created a small website using Adobe Muse and incorporated their form widget. However, I haven't altered any of the default settings and now the input boxes are not clickable. The only way to interact with them is by tabbing through. How can ...

Creating a see-through backdrop without the need for a background image

How can I create a div with a transparent background? I attempted to use background-color and opacity, but unfortunately, the border and text inside also became transparent. Check out an example here. Is there a way to achieve this without relying on a tr ...

Is there a way to create a dropdown menu that appears to emerge from behind a button?

I am struggling with the stack order of my dropdown menu. Despite using z-index, it appears in front of the button instead of behind it. I want it to look like it is coming out from behind the button. Here is my code: .subnav-wrapper { position: relat ...

When using ASP.NET with VB.NET, the issue of added rows to a data table not persisting after a postback arises

I am currently working with ASP.NET using VB.NET and I need the user to be able to add multiple rows to a data table. My issue is that when adding multiple rows to the data table at runtime using textboxes, rad combo box, and check boxes, only the last ro ...

Using <fieldset> allows you to display <select> elements in a vertical arrangement

As I work with this piece of html, JQuery populates my boxes and I am utilizing fieldsets to focus on only the necessary selection before POSTING it to my servlet. However, there seems to be an issue as the content is being displayed vertically when I ac ...

jqGrid: Enhance the advanced search dialog by updating the column dropdown feature following the addition of a column using the column

I am encountering an issue with the advanced search feature of the jqGrid. It appears that the advanced search dialog box is only generated once, when the searchGrid function is called. After I have opened the advanced search dialog once and then add a co ...

Issues with html2canvas crashing have been reported specifically on iOS devices

I recently developed a system for a client that enables users to select or upload an image of a car, input a number plate, adjust the positioning of the plate by moving, resizing, rotating, and skewing it as needed, and then download the modified image: E ...

Need assistance with jQuery AJAX?

Hey there, I'm a new member and I've gone through the different Ajax Help topics but still can't figure out why my code isn't working. Here's what I have: $(document).ready(function(){ $.ajax({ type: "GET", ur ...

Enhance user experience by implementing an autocomplete feature for a text input field

Can you name the process in which a form is automatically filled using database information without needing to refresh the page? One common example of this technique is seen on platforms like Google or Facebook, where they predict friends you may be searc ...