我试图用同位素过滤6个类别。我目前正在使用它,因此如果选择 package ie.example.artur.projectrepeat;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
/**
* Created by family on 10/08/2016.
*/
public class ListDataAdapter extends ArrayAdapter {
List list = new ArrayList ();
public ListDataAdapter(Context context, int resource) {
super(context, resource);
}
static class LayoutHandler
{
TextView id,product_name,category;
}
@Override
public void add(Object object) {
super.add(object);
list.add(object);
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
// pass you item position which you want to remove
public void removeItemAt(int position){
list.remove(position);
this.notifyDataStateChange();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutHandler layoutHandler;
View row = convertView;
if(row == null)
{
LayoutInflater layoutInflater = (LayoutInflater) this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = layoutInflater.inflate(R.layout.row_layout,parent,false);
layoutHandler = new LayoutHandler();
layoutHandler.id = (TextView) row.findViewById(R.id.product_id);
layoutHandler.product_name = (TextView) row.findViewById(R.id.product_name);
layoutHandler.category = (TextView) row.findViewById(R.id.product_category);
row.setTag(layoutHandler);
}
else {
layoutHandler = (LayoutHandler) row.getTag();
}
DataProvider dataProvider = (DataProvider) this.getItem(position);
layoutHandler.id.setText(dataProvider.getId());
layoutHandler.product_name.setText(dataProvider.getProduct_name());
layoutHandler.category.setText(dataProvider.getCategory());
return row;
}
}
,则会显示cat1
个项目,但如果我选择cat1
和cat1
,则会同时显示cat2
和cat1
个项目。我想要它只显示 BOTH cat2
和cat1
的项目。不只是单独显示它们。这可能吗?
这是我的combofilter
cat2
以下是我的按钮示例(复选框)
var data = {
accredited: 'seo social-media lead-generation marketing-automation blogging email-marketing'.split(' '),
};
function getComboFilter( filters ) {
var i = 0;
var comboFilters = [];
var message = [];
for ( var prop in filters ) {
message.push( filters[ prop ].join(' ') );
var filterGroup = filters[ prop ];
// skip to next filter group if it doesn't have any values
if ( !filterGroup.length ) {
continue;
}
if ( i === 0 ) {
// copy to new array
comboFilters = filterGroup.slice(0);
} else {
var filterSelectors = [];
// copy to fresh array
var groupCombo = comboFilters.slice(0); // [ A, B ]
// merge filter Groups
for (var k=0, len3 = filterGroup.length; k < len3; k++) {
for (var j=0, len2 = groupCombo.length; j < len2; j++) {
filterSelectors.push( groupCombo[j] + filterGroup[k] ); // [ 1, 2 ]
}
}
// apply filter selectors to combo filters for next group
comboFilters = filterSelectors;
}
i++;
}
var comboFilter = comboFilters.join(', ');
return comboFilter;
}
答案 0 :(得分:0)
您可以使用CSS选择器进行同位素过滤,
http://isotope.metafizzy.co/v1/docs/filtering.html
所以
$container.isotope({ filter: ".cat1.cat2" });
仅显示具有两个类
的元素