Last active
May 4, 2018 20:50
-
-
Save dudelis/765febe38e1620372ee0dfd5100ec9c2 to your computer and use it in GitHub Desktop.
K2: Select Listview rows with checkboxes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You need to do the following for the code to work: | |
//1. Add Literal datalabel to the list view and call it 'dlblScript'. | |
//2. Add a new column into the list view, add literal datalabel there and add a piece of the following html inside: | |
<input type="checkbox" class="custom-box"/> | |
//3. Add the following js into the dlblScript: | |
<script> | |
var contentTable = $("span[name='dlblScript']").closest('.grid').find('.grid-content-table')[0]; | |
var observer = new MutationObserver(function(mutations){ | |
$(contentTable).find('.custom-box').each(function(i, val){ | |
if ($(this).prop('checked')){ | |
$(this).closest('tr').addClass('highlighted selected'); | |
} else{ | |
$(this).closest('tr').removeClass('highlighted selected'); | |
} | |
}); | |
}); | |
var config = {attributes:true, subtree:true, characterData: true}; | |
observer.observe(contentTable, config); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment