Page 7 of 8

Re: Browse Table Filter Options

Posted: Fri Feb 11, 2022 9:41 pm
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'});
}

Re: Browse Table Filter Options

Posted: Sat Feb 12, 2022 5:08 am
by kev1n
You don't need to declare addBrowseTitleSelect(), just remove it. It's already included in nu 4.5.

Re: Browse Table Filter Options

Posted: Sun Feb 13, 2022 6:19 pm
by Duski
Doesn't work :-(
I found no differences versus form nuuser, which on mobile works ...
:-( :-( :-(

Re: Browse Table Filter Options

Posted: Sun Feb 13, 2022 8:12 pm
by kev1n
Is this also included in the db dump you sent me? And in which form is the code?

Re: Browse Table Filter Options

Posted: Mon Feb 14, 2022 6:24 pm
by kev1n
Could you send me a new db dump then I'll try to fix it.

Re: Browse Table Filter Options

Posted: Thu Feb 17, 2022 2:48 pm
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'});
//}

Re: Browse Table Filter Options

Posted: Thu Feb 17, 2022 3:33 pm
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 :-))

Re: Browse Table Filter Options

Posted: Thu Feb 17, 2022 3:48 pm
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.

Re: Browse Table Filter Options

Posted: Thu Feb 17, 2022 3:50 pm
by kev1n
but the filters show no effect...

Re: Browse Table Filter Options

Posted: Thu Feb 17, 2022 4:29 pm
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.