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

查看:141
本文介绍了在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..

任何人都知道解决方案.

Any one know the solution..

推荐答案

我已经使用

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();
});

我通过引用此文件来调用Ajax文件网址.

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

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