jQWidgets Forums

jQuery UI Widgets Forums Grid Problem loading data

This topic contains 1 reply, has 1 voice, and was last updated by  Programmerswe 9 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Problem loading data #82500

    Programmerswe
    Participant

    So, Im trying to load data from a service, returning a json into the grid. But I get this message:
    “Uncaught TypeError: Cannot read property ‘height’ of undefined”..
    This is the code (removed some data from it thats sensitive).

    
    jQuery.noConflict();
    
    (function ($) {
        $(document).ready(function () {
    	var subPath = '/local';
    
    	var sourceAlert = {
            datatype: "json",
            datafields: [{name: 'FirstName', type: 'string'},
                         {name: 'Id', type: 'string'},
                         {name: 'LastName', type: 'string'},
                         {name: 'UserName', type: 'string'},
    					 {name: 'Type', type: 'string'}],
    		//url: subPath + '/service/servicecall',
        };
    	
    	var alertAdapter = new $.jqx.dataAdapter(sourceAlert);
    	
    	var initRowDetails2 = function(index, parentElement, gridElement, row){
    		parentElement.firstChild.setAttribute("id","yourIframe2_"+row.Id);
    		}
    				
    	$("#jqxGrid2").jqxGrid(
    	{
    		theme: 'energyblue',
    		width: 1280,
    		filterable: true,
    		source: alertAdapter,
    		rowdetails: true,
    		columns: [
    			{ text: 'Användarnamn', datafield: 'UserName', width: 450, cellclassname:cellclassname },
    			{ text: 'Namn', datafield: 'FirstName', width: 400, cellclassname:cellclassname },
    			{ text: 'Efternamn', datafield: 'LastName', width: 400, cellclassname:cellclassname }
    		],
    		initRowDetails:initRowDetails2,
    		rowdetailstemplate: {
    			rowdetails: "<iframe style='height:100%; overflow-y:scroll; width:99%;' scrolling='yes'></iframe>",
    			rowdetailsheight: 600, 
    			rowdetailshidden: true
    		},
    		autoheight: true,
    	});
    	var RefreshTimerReload = 2;
    	var RefreshTimer = RefreshTimerReload;
    	setInterval(function(){
    		RefreshTimer--;
    		if (RefreshTimer <= 0)
    		{
    			now = new Date();
    			console.log('Refreshing time ... ' + now.toString());
    			$('#refresh-button').click();
    			RefreshTimer = RefreshTimerReload;
    		}           
    	}, 60000);
    
    	 $('#refresh-button').click(function () {
    		var text1 = $(this).data('tag');
    		if (text1 !== 'Refreshing') // there is data to refresh
    		{
    			$("#jqxGrid2").jqxGrid('updatebounddata', 'filter');
    			clearTimeout(myvar);
    			countdown(2);
    			//todo, reset timer
    		}
    	});
    	
    	var myvar;
    	function countdown(minutes) {
    		var seconds = 60;
    		var mins = minutes
    		function tick() {
    			var counter = document.getElementById("timer");
    			
    			var current_minutes = mins-1
    			seconds--;
    			counter.innerHTML =
    			current_minutes.toString() + ":" + (seconds < 10 ? "0" : "") + String(seconds);
    			if( seconds > 0 ) {
    				myvar = setTimeout(tick, 1000);
    			} else {
    	 
    				if(mins > 1){
    				  myvar =  setTimeout(function () { countdown(mins - 1); }, 1000);
    				}
    			}
    		}
    		tick();
    	}
    	
    	$('#refresh-button').click();	
    });
    }(jQuery));
    
    Problem loading data #82516

    Programmerswe
    Participant

    Nvm, I’ve fixed it. 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.