jquery - When running multiple javascript functions, only first few work -
i want run function on click runs multiple other javascript functions. works, first few functions called.
more detail: trying filter grid. "savedsearch" function called button search multiple fields according saved search criteria (i.e. filter column "monday", in model). each "sub-function" (the "appliedsearch" functions) applies different field. first few work (i've tried formatting many different ways). example, filter columns a, b, , c, nothing happens columns d, e, , f.
note: "applysearch" function trying call, "columna" field name sending function, @html.raw(json.encode(model.columna)) variable (i.e. "monday" in example above).
function savedsearch(e){ if (@html.raw(json.encode(model.columna)) != "0") { applysearch1("columna", @html.raw(json.encode(model.columna))); } if (@html.raw(json.encode(model.columnb)) != "0") { applysearch2("columnb", @html.raw(json.encode(model.columnb))); } if (@html.raw(json.encode(model.columnc)) != "0") { applysearch3("columnc", @html.raw(json.encode(model.columnc))); } if (@html.raw(json.encode(model.columnd)) != "0") { applysearch4("columnd", @html.raw(json.encode(model.columnd))); } if (@html.raw(json.encode(model.columne)) != "0") { applysearch5("columne", @html.raw(json.encode(model.columne))); } if (@html.raw(json.encode(model.columnf)) != "0") { applysearch6("columnf", @html.raw(json.encode(model.columnf))); } } }
the "applysearch" functions being called below (this works):
function applysearch(filterfield, filtervalue) { var griddata = $("#grid").data("kendogrid"); var currfilterobj = griddata.datasource.filter(); var currentfilters = currfilterobj ? currfilterobj.filters : []; if (currentfilters && currentfilters.length > 0) { (var = 0; < currentfilters.length; i++) { if (currentfilters[i].field == filterfield) { currentfilters.splice(i, 1); break; } } } if (filtervalue != "0" && filtervalue != "") { currentfilters.push({ field: filterfield, operator: "contains", value: filtervalue }); } griddata.datasource.filter({ logic: "and", filters: currentfilters }); }
Comments
Post a Comment