Page 1 of 1

Enhanced nuResizeBrowseColumns

Posted: Tue Jan 25, 2022 10:35 am
by nc07
Hello,

I have modified this code which may help in semi responsive browse form, of course there is a lot to be done. Iam sharing this for suggestions, and improvements.

Code: Select all

function nuResizeBrowseColumns(force){
             $(window).bind('load resize',(function() {
    

	var w	= nuArrayColumn(nuSERVERRESPONSE.browse_columns,'width').map(Number);
	var t	= 0;
	var p	= nuTotalWidth('nucell_0_0') - $('#nucell_0_0').width();	//-- padding

	if((nuFORM.getCurrent().refreshed != 0 && force !== true)  && nuMainForm()){return;}

	if(nuMainForm()){

		for(var i = 0 ; i < w.length ; i++){
			t = t + w[i];
		}

		for(var i = 0 ; i < w.length ; i++){
			w[i] = parseInt((window.innerWidth - 30) * w[i] / t) - p;
		}

	}else{

		var W	= nuTotalWidth('nuBrowseFooter') + 22;

		$('#nuDragDialog',	window.parent.document).css('width', W + 14);
		$('#nuWindow',		window.parent.document).css('width', W);

		$('body').css('width', W);

	}

	if(nuFORM.getCurrent().refreshed != 0 && force !== true){return;}

    nuSetBrowserColumns(w);
})).resize();
}
 

Re: Enhanced nuResizeBrowseColumns

Posted: Wed Jan 26, 2022 1:03 pm
by Timo
How do I use that function and what does it do?

Re: Enhanced nuResizeBrowseColumns

Posted: Fri Jan 28, 2022 12:43 am
by nc07
Timo wrote: Wed Jan 26, 2022 1:03 pm How do I use that function and what does it do?
chrome-capture (2).gif

The NB Browse columns will resize automatically on window resize. You can replace this function in nucommon.js.

Re: Enhanced nuResizeBrowseColumns

Posted: Fri Jan 28, 2022 7:20 am
by Timo
So I replaced the function, browser restarted but nothing happens. Please advise.

Re: Enhanced nuResizeBrowseColumns

Posted: Sat Jan 29, 2022 6:06 pm
by gerese
Timo wrote: Fri Jan 28, 2022 7:20 am So I replaced the function, browser restarted but nothing happens. Please advise.
Hi, add this code before the function nuOnLoad() under Setup-> Header:

Code: Select all

//Function that resizes columns based on window size;
$(window).resize(function() {
 clearTimeout(window.resizedFinished);
    window.resizedFinished = setTimeout(function(){
          if (!nuIsIframe())  nuResizeBrowseColumns(true);
    }, 250);
});
//Function that resizes columns based on window size;
... you can read that:
viewtopic.php?t=11448