Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Enhanced nuResizeBrowseColumns

Post your ideas & suggestions for new nuBuilder features or other improvements
Post Reply
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Enhanced nuResizeBrowseColumns

Unread post 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();
}
 
Last edited by nc07 on Mon Jan 31, 2022 11:16 pm, edited 3 times in total.
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Enhanced nuResizeBrowseColumns

Unread post by Timo »

How do I use that function and what does it do?
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Enhanced nuResizeBrowseColumns

Unread post 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.
You do not have the required permissions to view the files attached to this post.
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Enhanced nuResizeBrowseColumns

Unread post by Timo »

So I replaced the function, browser restarted but nothing happens. Please advise.
gerese
Posts: 132
Joined: Sun Dec 16, 2018 6:13 pm
Location: România
Has thanked: 30 times
Been thanked: 4 times

Re: Enhanced nuResizeBrowseColumns

Unread post 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
nuBuilderForte .... BIG Like !!!
Post Reply