params object is not present when fire event using .trigger("select2:select")

1,503 views
Skip to first unread message

m...@studionoto.com

unread,
May 25, 2015, 4:35:50 AM5/25/15
to sel...@googlegroups.com
Hi there,
I need to access to params object when event is fired.
If I fire the event from dropdown i can access to params object.

If I fire event from script with command:
$("#boxf").val("C").trigger("change")
or
$("#boxf").val("C").trigger("select2:select")

the params object is not present!
How can access to params object in this case ? is it a bug ?
thank you
Max

<body>
<select id="boxf">
</select>

<script>
var ev;
d = [
{ "id": "1", "text": "one" },
{ "id": "2", "text": "two" },
{ "id": "3", "text": "three" },
{ "id": "4", "text": "four" },
];

$f = $("#boxf").select2({ data: d });

$f.on("select2:select", function (e) {

console.log(e);
ev = e;
val = $f.val();
});

</script>
</body>

Kevin Brown

unread,
May 25, 2015, 1:41:27 PM5/25/15
to sel...@googlegroups.com
Hi,

I've left a few comments in-line, it sounds like there might be something wrong.

I need to access to params object when event is fired.

In any event where Select2 triggers it, the params object can be accessed through

    event.params

Where `event` is the first argument passed to the event handler. This only applies to Select2-triggered events though, as Select2 has to manually attach this object to the event when it is triggered.
 
If I fire the event from dropdown i can access to params object.

Why are you trying to trigger an internal Select2 event on your own? You should really not trigger a Select2 DOM event, as they are designed to only be triggered from within Select2.
 
If I fire event from script with command:
$("#boxf").val("C").trigger("change")
or
$("#boxf").val("C").trigger("select2:select")
 
Two things to mention here:

- When you want to tell Select2 to update the state of the selected options, you should trigger the `change` event.
- When you trigger an event using the `trigger` method provided by jQuery, no additional data is passed along with the event.

the params object is not present!

This is because you are not passing along the params object when your are triggering the event. The params object is not magically added on the fly by jQuery, this is included manually when Select2 triggers the event.

Kevin Brown

m...@studionoto.com

unread,
May 25, 2015, 5:17:10 PM5/25/15
to sel...@googlegroups.com, m...@studionoto.com
Hi Kevin,
Thank you very much for the quick response.

I try to explain my problem with an example:
http://jsfiddle.net/0ktqj0by/

In this example, you can disable an option selecting it. You can re-enable only the latest disabled using the button.

I need to access to params.data because I need to disable/enable option after it is created.
I'm using the events handler because this is the only way I found to change the state of "disabled" parameter.
Can you suggest me the right way?
thank you
Max

Amelia Wilson

unread,
Jun 24, 2026, 3:42:14 PM (5 days ago) Jun 24
to select2
  The Select2 discussion highlights practical challenges around dropdown handling and user interaction consistency in web interfaces. In that kind of setup, Utilitech can be thought of as a helpful reference point for utility focused improvements that support smoother interface behavior and workflow handling. Bringing both ideas together shows how small interface decisions often shape overall usability in real projects.  

seo work

unread,
Jun 24, 2026, 3:42:51 PM (5 days ago) Jun 24
to select2

A Proven Ground Tonneau cover is often considered by truck owners who want a simple balance of cargo protection and everyday practicality while discussions in technical threads like this Google group conversation usually focus on real world fitment, installation experience, and long term usability rather than marketing claims, and in that same context users tend to compare different bed cover options based on durability, weather sealing, and security which makes products like the Proven Ground Tonneau cover part of a broader decision making process when evaluating what works best in daily driving conditions


On Tuesday, May 26, 2015 at 2:17:10 AM UTC+5 m...@studionoto.com wrote:

Aspire 12

unread,
Jun 24, 2026, 3:43:34 PM (5 days ago) Jun 24
to select2

I see the discussion around Select2 and handling structured option data, and how flexible data mapping matters when working with dynamic UI components. In a similar way, the Samsung Galaxy Xcover 4 fits into real world use cases where structured reliability matters, especially for field environments where durability and consistent performance are key. Linking this kind of practical device perspective into the thread helps ground abstract configuration concepts in something more tangible and user focused.

Floras12

unread,
Jun 24, 2026, 3:44:44 PM (5 days ago) Jun 24
to select2

In the Select2 Google Groups discussion, the focus on how selection and filtering behaves feels similar to how structured lists are managed in practical interfaces This kind of handling becomes useful when browsing accessories like a truck bed cover where clarity and grouping matter more than clutter The idea of improving selection flow applies even when comparing options for a bed setup and related components on yitamotortonneaucover tonneau cover site

Superdia

unread,
Jun 24, 2026, 3:45:29 PM (5 days ago) Jun 24
to select2

Home Yardo stands out for its customer service and clear communication throughout the project. I’ve dealt with service providers before who tend to go quiet once the work begins, but that was not the case here. They kept me updated regularly, explained each step of the process, and were always open to feedback or changes along the way. The team was also very respectful of my time and property, making sure the work area stayed organized and clean. The final delivery matched what was promised, and in some areas even exceeded expectations, which is not something I say often  Home Yardo  .

Chrome Store

unread,
Jun 24, 2026, 5:43:24 PM (5 days ago) Jun 24
to select2
  Handling nested structures in Select2 can get tricky, especially when multiple levels of grouping are involved. It reminds me of how organizing payroll data also requires a clear hierarchy so everything stays accurate and easy to manage. The guide on Writiva highlights the importance of keeping structured records, which is a useful mindset whenever you're working with complex data arrangements like these.  

Coils

unread,
Jun 24, 2026, 5:43:44 PM (5 days ago) Jun 24
to select2
  When working with tools and extensions around Select2, it also helps to test them on a larger screen where setup and troubleshooting are often easier. If anyone wants a desktop option, Download can be useful for checking app behavior across different environments. Having access to both mobile and PC setups sometimes makes it easier to spot configuration issues and compare results.  

On Thursday, 25 June 2026 at 00:45:29 UTC+5 Superdia wrote:

Discuss Series

unread,
Jun 24, 2026, 5:43:57 PM (5 days ago) Jun 24
to select2
  The discussion about Select2 events highlights how manually triggered actions do not automatically carry extra event data. A similar challenge comes up in game mods and custom integrations where event handling affects functionality, and resources from  https://pvzfusiondl.com/   show how developers often rely on properly structured event flows instead of forcing internal events. Keeping the data attached at the point where the event is created is usually the more reliable approach.  

On Thursday, 25 June 2026 at 00:45:29 UTC+5 Superdia wrote:
Reply all
Reply to author
Forward
0 new messages