Fastadmin在原有篩選條件filter基礎之上,js重新附加新條件

温柔的风發表於2024-09-01
 $(document).on('click','.small_customer_number_item',function(){

                var small_customer_number_index = $(this).attr('small_customer_number_index');
                var options = table.bootstrapTable('getOptions');
                var queryParams = options.queryParams;
                options.pageNumber =1;
                options.queryParams = function (params) {
                    params = queryParams(params);//這一行必須要存在,否則在點選下一頁時會丟失搜尋欄資料
                    var filter      = params.filter ? JSON.parse(params.filter) : {};
                    var op          = params.op ? JSON.parse(params.op) : {};
                    filter.small_customer_number_index = small_customer_number_index;
                    op.small_customer_number_index = '=';
                    params.filter   = JSON.stringify(filter);
                    params.op       = JSON.stringify(op);
                    return params;
                };
                table.bootstrapTable('refresh', {});
                return false;
            })

  

相關文章