Created
January 3, 2017 23:37
-
-
Save paulroth3d/bea07e4860a52fa64686a103991b870c to your computer and use it in GitHub Desktop.
Dom Manipulation Example
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
//-- for more information, please see: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver | |
//-- creates the observer that will fire the function when the dom is updated. | |
//-- in this case when we scroll, there are new elements added to the fixedHeaderContainer | |
//-- so we just run from that | |
//-- if we wanted to be smarter, we can look through the mutations arguments to see if | |
//-- any mutation records (i.e. mutations[0].addedNodes is greater than 0) | |
var observer = new MutationObserver( function( mutations, observer ){ | |
console.log( "mutations occurred" ); console.log( mutations ); console.log( this ); | |
jq( "#gbMainTable > tbody > tr > td.fixedHeaderContainer tr td[name='v5']" ).hide(); | |
jq( "#gbMainTable > tbody > tr > td.fixedHeaderContainer tr td[name='v6']" ).hide(); | |
}); | |
//-- configuration for the observer | |
var mutationConfig = { attributes: true, childList: true }; | |
//-- observer.observe( htmlElement, mutationConfig ) | |
//-- this monitors for any mutations on #gbMainTable ... fixedHeaderContainer | |
//-- note we are using direct descendants to avoid listening on child grids. | |
observer.observe( jq( "#gbMainTable > tbody > tr > td.fixedHeaderContainer")[0], mutationConfig ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment