in joomla 3 how to include auto complete search

时光怂恿深爱的人放手 提交于 2019-12-14 03:16:03

问题


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..


回答1:


I have solved my problem using select.js.

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

I called Ajax file by refer this url.



来源:https://stackoverflow.com/questions/18668866/in-joomla-3-how-to-include-auto-complete-search

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!