Realize the dynamic drop-down list search function in the fastadmin search bar

Using the background automatically generated by fastadmin, when there are classified search items in the search bar, the text box search is displayed by default, and we want to implement dynamic drop-down list search. The following effects are achieved.
Insert picture description here
Find the js file of the corresponding file and modify it as follows

//模糊搜索
{
    
    field: 'pclass.cname', title: __('Pclass.cname'), operate: 'LIKE %...%', placeholder: '模糊搜索,*表示任意字符'},

Then add the following code in the js file, which must be added var table = $("#table");after

table.on('post-common-search.bs.table', function (event, table) {
    
    
    var form = $("form", table.$commonsearch);
    $("input[name='pclass.cname']", form).addClass("selectpage").data("source", "pclass/index").data("primaryKey", "cname").data("field", "cname").data("orderBy", "id desc");
    Form.events.cxselect(form);
    Form.events.selectpage(form);
 });

For specific parameters, please refer to the properties of the dynamic drop-down list below
Is the method of query classification

Guess you like

Origin blog.csdn.net/qq_36129701/article/details/108364882