javascript - Unique names are not coming in jqgrid filter functionality -
i have implemented filter functionality in jqgrid. logic iterate on data of grid , find unique values filter. selecting values present in filter can apply filter. 1 of strings present in column coming twice , same. e.g. row 1 : "abc", row 2: "abc",row 3: "def", row 4: "def", row 5 :"feg" values in filter should all,abc,def,feg getting all,abc,abc,def,feg. def not repeating. problem string or else. code is
getuniquenames = function(columnname) { var data = $("#grid0").jqgrid('getgridparam', 'data'); var uniquetexts = [], text, textsmap = {}, i; (i = 0; < data.length; i++) { text=data[i][columnname]; if (text !== undefined && textsmap[text] === undefined) { // test whether texts unique place in map. textsmap[text] = true; if (typeof text =="string" && text.trim()!=''){ uniquetexts.push(text); } } } // object.keys(textsmap); not work ie8: return uniquetexts; }
Comments
Post a Comment