jQWidgets Forums

jQuery UI Widgets Forums Grid global text search causes markup-issue

Tagged: ,

This topic contains 4 replies, has 2 voices, and was last updated by  StefanT 10 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author

  • StefanT
    Participant

    Greetings from Germany

    I’m playing aroud with some sort of global search-ability. For that reason I’ve created an input field in my table-toolbar. That input has an keyup event-handler like this:

    function setGlobalFilter(filtervalue) {
    	$("#myGrid“).jqxGrid({ showfiltercolumnbackground: false });
    	var columns = $("#myGrid").jqxGrid('columns');
    	for(var i = 0; i < columns.records.length; i++) {
    		var filtergroup = new $.jqx.filter();
    		var filter = filtergroup.createfilter('stringfilter', filtervalue, 'contains');
    		filtergroup.operator = 'or';
    		filtergroup.addfilter(1, filter);
    		$("#myGrid").jqxGrid('addfilter', columns.records[i].datafield, filtergroup);
    	}
    	$("#myGrid“).jqxGrid('applyfilters');
    	$("#myGrid").jqxGrid('autoresizecolumns');
    }

    As far as I remember I adopted that functionality from DataTables (or from one of your examples). As I type in something it might come to the point where there are no more results to show. In that case a span-tag is created (or just shown, I don’t know) with the value of: localizationobj.emptydatastring.

    If I now remove my search string, recordsets (rows) start showing up again. And to me it seemes that the very first cell-value is now located in that span-tag mentioned above (which is not normal, isn’t it). That behaviour is causing serious positioning-issues (again: just the first cell value).

    Is it possible that somehow that message (and it’s wrapper) is not removed correctly?
    Is it my fault, am I missing something in my construction?

    This happens in all browsers I’ve tested (Chrome 35, FF 30, IE8/9/10). The jQuery-Version I’m currently using is 1.11. I’m on the lates Version of jqWidgets and I’m working on a PC.

    I hope my descriptions are not to confusing.
    Thank you so very much for helping out.

    STEFAN


    Peter Stoev
    Keymaster

    Hi Stefan,

    Unfortunately, by using your descriptions we would not be able to reproduce your scenario. The “No Data to Display” message is displayed when the Grid has no records to show. When it has, the Grid displays records. The message is created and removed correctly. However, a thing which worries me here is that the code here uses non-documented APIs and dynamically applies filters, but there is also no code for clearing these custom filters. If you would like someone to try to help you, you may prepare and share a jsfiddle sample which illustrates your scenario. Alternatively, you can use jqxDataTable which has the feature you try to implement already built-in.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    StefanT
    Participant

    Hello again (please excuse my delay.. and my english)

    I was playing around with one of your examples (from the grid-api-documentation).
    Here you can see what the issue is: http://jsfiddle.net/CvGLP/18

    Now there is a toolbar within an input-field.
    If you type in something that isn’t in the grid (e.g. “?”) you will get the “No data to display”-message (depending on your localization).
    If you then delete your searchstring from the input.. your very first cell value just disappears (at least it seemed to)
    =(

    As far as I can guess, the very first value is now wrapped into an additional span-tag (within its normal div).
    This span seems to have quite the same css-values as the “No data to display”-message-wrapper..
    That leads me to think that the message isn’t removed correctly.

    All examples I found unfortunately just illustrates server-side searching, so I have absolutly no more clue what I’m missing on my way.

    Thanks again for your time and patience.

    STEFAN from DRESDEN


    Peter Stoev
    Keymaster

    Hi Stefan,

    We will test your scenario. In the meantime, you can use: $(“#jqxgrid”).jqxGrid(‘refresh’); after calling “clearfilters”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    StefanT
    Participant

    Thank you so very much for the fastest answers i’ve ever experienced.
    It works like a charm.

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

You must be logged in to reply to this topic.