Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How Can I Make The Delete Button Triggered When Clicked? Rate Topic   - - - - -

 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 05 August 2019 - 06:57 AM #1

There is category add field in product page. (See attached image.) I know, there are javascript hooks in cs cart. I want let the delete/remove button trigged and redirect it somewhere I want when clicked to remove like code below:

$.ceAjax('request', fn_url('cce_paket_yonetimi.save?id=' + object.id ), {
				 
});

Normally, I can use a redirection when clicked to add a category:

  $.ceEvent('on', 'ce.select_template_selection', function (object, list_elm, $container) {
		
		if ($container.hasClass('cm-object-categories-add') && object.data) {

                        $.ceAjax('request', fn_url('cce_paket_yonetimi.save?id=' + object.id + '&time=' + time ), {
				 
			});

                }
  }

I just want to do it when clikced to remove after selected of template.

 

In the following file \js\lib\select2\select2.full.min.js  there are some code which makes it triggered.

This line:

this.$selection.on("click",".select2-selection__choice__remove",function(b){

How can I use a hooks to use this? BTW, I need ID of category which is clicked to remove. I am not sure if this ID is in b variable.

 

 

You may aslo help about using functions in \js\lib\select2\select2.full.min.js file. That can help me. 



 
  • ooaykac
  • Senior Member
  • Members
  • Join Date: 22-Nov 12
  • 297 posts

Posted 06 August 2019 - 03:17 PM #2

Cs cart uses select2 functions which are defined in \js\lib\select2\select2.full.min.js file.

 

I found that I should use select2 functions. If you need something like this check out the link following : https://select2.org/...-control/events