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
436 stars 177 forks source link

Can [Textbox Filter] search the contents of the input box? #241

Closed wmktz1 closed 5 years ago

wmktz1 commented 7 years ago

For example, if I enter a word "12" in filter box ,but this "12" in inputBox`s value.

<div class="text-filter-box">
    <input style="margin-right:8px;"
      data-path=".desc"
      type="text"
      value=""
      data-control-type="textbox"
      data-control-name="desc-filter"
      data-control-action="filter"/>
</div>

<table ...>
   ...
   <td  class="desc">
       <input type="text" name="salePrice" value="12" class="salePrice">&nbsp;$
   </td>
   ...
</table>

How can i search this?

Thanks in advance,

WMK@

1rosehip commented 7 years ago

Unfortunately search in attributes is not supported for now :(

wmktz1 commented 7 years ago

Thanks for your answer

wmktz1 commented 7 years ago

i try to add style is "diaplay:none;" to copy inputs val, then delete old item and add new item. its woring now,`s value can be searched.

However, new problem is raised. I change my input value. My table has be sorted , then i add one item. new item will be sort, commandData`s index is invalid.


<!-- JPList-->
<script>
    $('document').ready(function(){
        $(".desc input").each(function(){
            $(this).prevAll(".hiddenInput").text($(this).val());
        });

        $('#goodslist').jplist({
            itemsBox: '.goodsData'
            ,itemPath: '.good-item'
            ,panelPath: '.jplist-panel'
        });
    });
</script>

<script>
    $(document).ready(function(){
        $("#goodslist").on("blur", ".desc .salePrice", function(){
            var oldgood = $(this).parents(".good-item");
            var oldindex = oldgood.index();
            $(this).prevAll(".hiddenInput").text($(this).val());
            var newgood = $(this).parents(".good-item");

            $('#goodslist').jplist({
                command: 'del'
                ,commandData: {$items: $(oldgood)}
            });

            $('#goodslist').jplist({
                command: 'add'
                ,commandData: {$item: $(newgood)
                ,index: oldindex}
            });
        });
    });
</script>

After i add new item , can table not sort it?