Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Raghu on Dec 04, 2008 22:59
open dhtmlx forum
Grid

Hi,
I am trying to exit out of a function but i am getting error.
Can you guide me how to exit of the function
mygrid.filterBy(mygrid.getColIndexById(thisp.title),function(a){

    a = a.replace(/(<[^>]*>|\$|,)/g,"");
    if(text_value.match(/^([><=](\d+|\d+\.\d{0,2})|(\d+|\d+\.\d{0,2})\.\.(\d+|\d+\.\d{0,2}))$/) != null){
      if(text_value.split("..").length > 1)
        return eval(a+ " > "+text_value.split("..")[0] +" && "+a+" < "+text_value.split("..")[1]);
      else
        return eval(a+text_value.replace(/=/,"=="));
    }
    else if(text_value.blank()){ resetFilter();break; return a;}
  });
Answer posted by Support on Dec 05, 2008 01:55
There is no way to break master loop from custom filtering function, instead of it you can reorganize your code as

if (!text_value.blank())
mygrid.filterBy(mygrid.getColIndexById(thisp.title),function(a){
  a = a.replace(/(<[^>]*>|\$|,)/g,"");
  if(text_value.match(/^([><=](\d+|\d+\.\d{0,2})|(\d+|\d+\.\d{0,2})\.\.(\d+|\d+\.\d{0,2}))$/) != null){
      if(text_value.split("..").length > 1)
          return eval(a+ " > "+text_value.split("..")[0] +" && "+a+" < "+text_value.split("..")[1]);
      else
           return eval(a+text_value.replace(/=/,"=="));
  }
});