1rosehip / jplist

jPList jQuery Data Grid Controls is a flexible jQuery plugin for sorting, pagination and filtering of any HTML structure (DIVs, UL/LI, tables, etc).
http://jplist.com
Other
438 stars 176 forks source link

data-mode="startsWith" doesn't work in combination with 'Filter any text' #186

Closed ghost closed 8 years ago

ghost commented 8 years ago

For example, when I use the included example "9-textbox-filter-search-any-text.html" and add the startWith data-mode, and then try to filter any text that starts with "C" it says "No results found", but there should.

1rosehip commented 8 years ago

The issue is in demo page styling. If you check HTML you can see that date tag is located above the title:

                    <div class="block">
                        <p class="date">05/08/2003</p>
                        <p class="title">Calendar</p>
                        <p class="desc">A calendar is a system of organizing days for social, religious, commercial, or administrative purposes. This is done by giving names to periods of time, typically days, weeks, months, and years. The name given to each day is known as a date. Periods in a calendar (such as years and months) are usually, though not necessarily, synchronized with the cycle of the sun or the moon.</p>
                        <p class="theme">
                            <span class="other">Other</span>
                            <span class="group1">Group 1</span>
                        </p>
                        <p class="like">18 Likes</p>
                    </div>

So the first character is a number and not "C" in this case. The date style is "float: right", that's the reason it looks like it's located after the title.

ghost commented 8 years ago

Not sure if you understand the question. It doesn't matter how and where the date style is done, it called "search any text" so it should find some data when I filter for "C".

So right now, when I type "C" in the filter input, no results are found, but this is wrong because the word "Calendar" and the word "Christmas Tree" should be filtered as they begins with an "C" character.

1rosehip commented 8 years ago

When you use * in the text box filter data path, it means that it takes text from the whole html structure as one string. In the example above it will be:

05/08/2003 Calendar A calendar is a system of organizing days for social, religious, commercial, or administrative purposes. This is done by giving names to periods of time, typically days, weeks, months, and years. The name given to each day is known as a date. Periods in a calendar (such as years and months) are usually, though not necessarily, synchronized with the cycle of the sun or the moon. Other Group 1 18 Likes

This text starts from "0" and not from "C", so you see "no results found". If you need filter by title you should change your data-path to be .title instead.

ghost commented 8 years ago

Ah I see, I removed data-path="*" and now it is working fine, thanks again!