deas / contentreich-alfresco-datalists

Datalist Extensions for Alfresco Share
16 stars 26 forks source link

When using default boolean control (checkbox) as filter field the filter stops to work #48

Open billerby opened 8 years ago

billerby commented 8 years ago

This is because of the handling of the hidden field being generated for the checkbox. The code in extended-datagrid.js assumes that it is a "select" type when there is an hidden field and the code subsequentially fails on a length check. I don't have time to do a pull request now, but I'll post the fix here so I (or someone else) can do it later on.

                     }else if (element.type == "hidden" && filterData[name].split(",").length > 0)
                         {
                            element.value=filterData[name];
                            var selectElement = Dom.get(element.id+"-entry");
                            if (selectElement.type != "checkbox"){
                               values = filterData[name].split(",");

                               for (var j = 0, jj = selectElement.options.length; j < jj; j++)
                               {
                                  if (Alfresco.util.arrayContains(values,selectElement.options[j].value))
                                  {
                                      selectElement.options[j].selected= true; 
                                  }else{
                                      selectElement.options[j].selected= false;
                                  }
                               }
                            }else {
                                element.value=filterData[name];
                            }

                        }