DataView를 사용하지 않고 Slickgrid를 필터링 할 수 있습니까?Datickiew없이 Slickgrid 필터링
정확하게 표시하기 위해 데이터 배열을 어떻게 구성해야합니까?
나는 atm 예제가 없습니다. 감사합니다
나중에 편집 :
좀 더 숙제를 한 후, 필터링 데이터 그리드는 모든 중첩 된 배열에 일치하는 인덱스를 받고 ... (grid.setData으로 업데이트되는 라이브 분류 결과 세트를 얻을 수에 관한 것입니다 filterData), 그리드 렌더링, 하나는 다음
function intersect(a, b) // find an intersection of 2 arrays (google result on SO
{
var ai=0, bi=0;
var a = a.sort();
var b = b.sort();
var result = new Array();
while(ai < a.length && bi < b.length)
{
if (a[ai] < b[bi]){ ai++; }
else if (a[ai] > b[bi]){ bi++; }
else /* they're equal */
{
result.push(a[ai]);
ai++;
bi++;
}
}
return result;
}
// given results sets are arrays of indexes matching search criteria
a = [1,2,3,4];
b = [2,3,4,5];
c = [3,4,5,6];
d = [4,5,6,7];
// should reunite in a nested array
array = [a,b,c,d];
// check intersections for each array[k] and array[k+1]
k = array[0];
for (var i = 0; i<array.length-1; i++){
k = intersect(k,array[i+1]);
}
console.log(k) // returns 4
// k array is the index array that
// is used to build filterData[i] = data[j]
// depends if id is stored in data or in case
// of a database, it is stored in data
// tested in firebug
// thanks
원본 질문 (또는 SlickGrid 데이터 필터링)이 데이터 구조 및 필터 작업과 관련이 없으므로 코드가 혼란 스럽습니다. – Tin