0
AjaxCrud有一个问题。创建关系时,将使用输入文本字段创建搜索。在ajaxCrud的addAjaxFilterBox defineRelationship字段上搜索
因此,如果您与另一个表有关系,则无法使用外表的描述字段。您必须使用外键的ID进行搜索。 失败
那么,我的用户甚至不知道有ID字段。
所以我真的需要使用外键表值来更改那些带有字段的输入文本。
我的解决方案就在下面。
AjaxCrud有一个问题。创建关系时,将使用输入文本字段创建搜索。在ajaxCrud的addAjaxFilterBox defineRelationship字段上搜索
因此,如果您与另一个表有关系,则无法使用外表的描述字段。您必须使用外键的ID进行搜索。 失败
那么,我的用户甚至不知道有ID字段。
所以我真的需要使用外键表值来更改那些带有字段的输入文本。
我的解决方案就在下面。
我已经改变了ajaxCRUD.class.php
近线1191,
之间
$top_html .= "</select>\n";
} and `else{
$custom_class = "";
if ($this->display_field_with_class_style[$filter_field] != '') {`
我已经插入此代码:
else
if (is_numeric($found_category_index))
{
$category_field_name = $this->category_field_array[$found_category_index];
$category_table_name = $this->category_table_array[$found_category_index];
$category_table_pk = $this->category_table_pk_array[$found_category_index];
$order_by = '';
if ($this->category_sort_field_array[$found_category_index] != ''){
$order_by = " ORDER BY " . $this->category_sort_field_array[$found_category_index];
}
$whereclause = '';
if ($this->category_whereclause_array[$found_category_index] != ''){
$whereclause = $this->category_whereclause_array[$found_category_index];
}
$dropdown_array = q("SELECT $category_table_pk, $category_field_name FROM $category_table_name $whereclause $order_by");
$top_html .= "<br><select name=\"$filter_field\" onChange=\"filterTable(this, '" . $this->db_table . "', '$filter_field', '$extra_query_params');\">";
$top_html .= "<option value=\"\">==Select==</option>\n";
foreach ($dropdown_array as $dropdown)
{
$dropdown_value = $dropdown[$this->category_table_pk_array[$found_category_index]];
$dropdown_text = $dropdown[$this->category_field_array[$found_category_index]];
$top_html .= "<option value=\"$dropdown_value\" >$dropdown_text</option>\n";
}
$top_html .= "</select>\n";
}
而且我已经包括这条线$found_category_index = array_search($filter_field, $this->db_table_fk_array);
此后一个:foreach ($this->ajaxFilter_fields as $filter_field){
近l ine 1156.
它通过关系数组并创建基于查询结果的选定内容。
如果此人解决了您的问题,请投票。分享,如果你有更好的解决方案。