As you can see I am using a template for my web development (AdminLTE), in this case the AdminLTE, and I am using the jqGrid to work my records.
What I want is to obtain the current width of an element after having made the expand / collapse event.
<script>
jQuery(function($) {
var grid_selector = "#grid-table";
var pager_selector = "#grid-pager";
//Obtener un Elemento
var parent_column = $(grid_selector).closest('[class*="col-"]');
//Redimensiono inicialmente
$(window).on('resize.jqGrid', function () {
$(grid_selector).jqGrid( 'setGridWidth', parent_column.width() );
})
$(document).on('collapsed.pushMenu expanded.pushMenu', function(ev){
var event_name = ev.type;
if( event_name === 'collapsed' || event_name === 'expanded' ) {
setTimeout(function() {
//Aqui es donde no puedo obtener el ancho del elemento, para poder redimensionar mi jqGrid
var parent_column = $(grid_selector).closest('[class*="col-"]');
$(grid_selector).jqGrid( 'setGridWidth', parent_column.width() );
}, 20);
}
});
})
</script>
As you will see after detecting the event collapsed / expanded I can not get the current width of the element saved in the variable "parent_column".
Greetings!