Fixed bugs in MemberTableField search

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61614 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-08-27 04:58:34 +00:00
parent a009cf5341
commit 725ba3a610
2 changed files with 5 additions and 6 deletions

View File

@ -135,8 +135,8 @@ class MemberTableField extends ComplexTableField {
$SQL_search = isset($_REQUEST['MemberSearch']) ? Convert::raw2sql($_REQUEST['MemberSearch']) : null;
if(!empty($_REQUEST['MemberSearch'])) {
$searchFilters = array();
foreach($SNG_member->stat('searchable_fields') as $fieldName => $fieldSpec) {
$searchFilters[] = "`$fieldName` LIKE '%{$SQL_search}%'";
foreach($SNG_member->searchableFields() as $fieldName => $fieldSpec) {
if(strpos($fieldName,'.') === false) $searchFilters[] = "`$fieldName` LIKE '%{$SQL_search}%'";
}
$this->sourceFilter[] = '(' . implode(' OR ', $searchFilters) . ')';
}
@ -392,6 +392,7 @@ class MemberTableField extends ComplexTableField {
// We use the group to get the members, as they already have the bulk of the look up functions
$start = isset($_REQUEST['ctf'][$this->Name()]['start']) ? $_REQUEST['ctf'][$this->Name()]['start'] : 0;
$this->sourceItems = $this->group->Members(
$this->pageSize, // limit
$start, // offset

View File

@ -214,7 +214,7 @@ MemberFilterButton.prototype = {
initialize: function() {
this.inputFields = new Array();
var childNodes = this.parentNode.getElementsByTagName('input');
var childNodes = this.parentNode.parentNode.getElementsByTagName('input');
for( var index = 0; index < childNodes.length; index++ ) {
if( childNodes[index].tagName ) {
@ -246,9 +246,7 @@ MemberFilterButton.prototype = {
var updateURL = "";
updateURL += Event.findElement(e,"form").action;
// we can't set "fieldName" as a HiddenField because there might be multiple ComplexTableFields in a single EditForm-container
updateURL += "&fieldName="+$('MemberFieldName').value;
updateURL += "&action_callfieldmethod&methodName=ajax_refresh&";
updateURL += '/field/' + $('MemberFieldName').value + '/ajax_refresh?ajax=1&';
for( var index = 0; index < this.inputFields.length; index++ ) {
if( this.inputFields[index].tagName ) {
updateURL += this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value ) + '&';