在 joomla 3 中如何包含自动完成搜索 [英] in joomla 3 how to include auto complete search

查看:12
本文介绍了在 joomla 3 中如何包含自动完成搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建自定义组件,其中正在使用自定义 fieldtype (mycomponent/models/fields/productcategory.php) 创建产品类别列表框. 它还在右侧显示了产品笼子方式.

I am creating custom component,in that In that am creating product category list box by using custom fieldtype (mycomponent/models/fields/productcategory.php). It also showing the product cagetory in right manner.

我需要创建选择列表框自动完成搜索像模块管理器中的位置字段..

i need to create select listbox with auto complete search like position field in module manager..

谁知道解决办法..

推荐答案

我已经使用 select.js.

I have solved my problem using select.js.

jQuery 编码是:

The jQuery coding is:

jQuery(document).ready(function($) {
  jQuery(".productcat").change(function(){
    fk_productcat = $("#" + this.id).val();
    //alert(fk_productcat);
    jQuery.ajax({
      url:'index.php?option=com_gwerp&task=stocks.getListArticles',
      type: "POST",
      data: {
        'fk_productcat': fk_productcat
      }
    }).done(function(msg) {
      console.log(msg);
      jQuery(".product").html(msg);
      jQuery( ".product" ).val(msg).trigger( "liszt:updated" );
      jQuery("#jform_fk_product_code").select2();
    })
  })
});

jQuery(document).ready(function() {
  jQuery("#jform_fk_productcat").select2();
});

jQuery(document).ready(function() {
  jQuery("#jform_fk_product_code").select2();
});

我通过参考this调用了Ajax文件网址.

这篇关于在 joomla 3 中如何包含自动完成搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆