Welcome to the nuBuilder Forums!

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

Browse Table Filter Options Topic is solved

Questions related to using nuBuilder Forte.
Duski
Posts: 95
Joined: Thu Mar 04, 2021 2:03 pm

Re: Browse Table Filter Options

Unread post by Duski »

Sorry, I'm already a little bit frustrated of myself :-(
Doesn't work on mobile:

Code: Select all

if (nuFormType() == 'browse') {
    var arrAutori = JSON.parse(getAutori());
    nuAddBrowseTitleSelect(1, arrAutori);                          // add dropdown to column 2 (index 1)
    $('#nuBrowseTitle1_select').parent().unbind("touchstart");
    
    var arrKategorie = JSON.parse(getKategorie());            // add dropdown to column 5 (index 4)
    nuAddBrowseTitleSelect(4, arrKategorie);
    $('#nuBrowseTitle4_select').parent().unbind("touchstart");

    var arrMedia = JSON.parse(getMedia());                      // add dropdown to column 6 (index 5)
    nuAddBrowseTitleSelect(5, arrMedia);
    $('#nuBrowseTitle5_select').parent().unbind("touchstart");

    var arrJazyky = JSON.parse(getJazyky());                   // add dropdown to column 4 (index 3)
    nuAddBrowseTitleSelect(3, arrJazyky);
    $('#nuBrowseTitle3_select').parent().unbind("touchstart");
}

// Function to add a dropdown to a title of a Browse Screen 
// * @param {number} index - browse index where the dropdown should appear
// * @param {object} data -  array to populate the dropdown
function addBrowseTitleSelect(index, data) {
	
//	var dropId = "nuBrowseTitle" + index + "_dropdown";
        var dropId = "nuBrowseTitle" + index + "_select";
	var list = document.createElement('select');
	
	list.setAttribute("id", dropId);
        var w = nuCurrentProperties().column_widths[index] - 10;
	list.setAttribute('style', 'width:'+ w +'px');


	for (var i = 0; i < data.length; i++) {
		var opt = document.createElement('option');
		opt.innerHTML = data[i];
		opt.value = data[i];
		list.appendChild(opt);
	}

	// append select to the browse title
	$('#nuBrowseTitle'+index).append('<br/>').append(list);

	$('#'+dropId).on('change', function (e) {
		var optionSelected = $("option:selected", this);
		nuSetProperty(this.id,this.value);
		nuSearchAction();
	});

	$('#nuBrowseTitle'+index).on('mousedown' , '> select' , function(e){
		e.stopPropagation();
	});

	 var dropValue = nuGetProperty(dropId);
	 $("#"+dropId).val(dropValue);
}

if( nuFormType() == 'browse') {
    $('#nuActionHolder').css({'height': '60px'});
}
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

You don't need to declare addBrowseTitleSelect(), just remove it. It's already included in nu 4.5.
Duski
Posts: 95
Joined: Thu Mar 04, 2021 2:03 pm

Re: Browse Table Filter Options

Unread post by Duski »

Doesn't work :-(
I found no differences versus form nuuser, which on mobile works ...
:-( :-( :-(
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

Is this also included in the db dump you sent me? And in which form is the code?
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

Could you send me a new db dump then I'll try to fix it.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

In your frm_knihy form, use this code to render the select objects correctly:

Code: Select all

$(function() {

    var arrAutori = JSON.parse(getAutori());
    nuAddBrowseTitleSelect(1, arrAutori);                     // add dropdown to column 2 (index 1)
    $('#nuBrowseTitle1_select').parent().unbind("touchstart");
    
    var arrKategorie = JSON.parse(getKategorie());            // add dropdown to column 5 (index 4)
    nuAddBrowseTitleSelect(4, arrKategorie);
    $('#nuBrowseTitle4_select').parent().unbind("touchstart");

    var arrMedia = JSON.parse(getMedia());                    // add dropdown to column 6 (index 5)
    nuAddBrowseTitleSelect(5, arrMedia);
    $('#nuBrowseTitle5_select').parent().unbind("touchstart");

    var arrJazyky = JSON.parse(getJazyky());                  // add dropdown to column 4 (index 3)
    nuAddBrowseTitleSelect(3, arrJazyky);
    $('#nuBrowseTitle3_select').parent().unbind("touchstart");

});


// zväčšenie záhlavia https://forums.nubuilder.cloud/viewtopic.php?t=9851&hilit=filter+browse&start=30

//if( nuFormType() == 'browse') {
//    $('#nuActionHolder').css({'height': '60px'});
//}
Duski
Posts: 95
Joined: Thu Mar 04, 2021 2:03 pm

Re: Browse Table Filter Options

Unread post by Duski »

Thank you Kev.
On PC works well, but on my tablet it is veeeery slow. It lasts 30 seconds to roll out the dropdown list and even minutes to filter the database.
But probably it is because my tablet is weak and there are 8300 records in the database :-(
You can try http://katalog.jecool.net/index.php?u=hocikto&p=4321
(Login with parameters doesn't work for me, but maybe for you will :-))
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

Logging in with parameters works just fine - both on a desktop pc and mobile phone.
The speed is reasonable, even when throttling the speed to a slow 3G connection.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Browse Table Filter Options

Unread post by kev1n »

but the filters show no effect...
Duski
Posts: 95
Joined: Thu Mar 04, 2021 2:03 pm

Re: Browse Table Filter Options

Unread post by Duski »

Ad loggin in with parameters: on Chrome, Vivaldi - no success, on Firefox, Edge - success
Ad filters on mobile: for me they sometimes work sometimes don't :-( Strange ... But on PC filters work well.
Post Reply