jquery-bracket
jquery-bracket copied to clipboard
Querying results and triggering events from score updates
Thanks for answer, but on page with examples I have not found info needed for me.
Сan you please help me, is it any method to get info about concrete match? This info should contain ids of winner and loser. Also, can I find some event like "match score changed" to track changes in matches result made by user?
Thanks, Alexander
method to get info about concrete match
There isn't any build-in way to do queries to the results, all you can get data-wise is provided for the save
callback (when the data is modified). It's in the format that you give in init
, i.e. something like this:
{
teams : [
["Team 1", "Team 2"],
["Team 3", "Team 4"]
],
results : [[1,0], [2,7]]
}
If you want the data in some other format, you'd need to transform it from this data.
can I find some event like "match score changed" to track changes in matches result
There is no event or callback for score modification specifically. Only built-in event triggered by score modification is the save
callback. Decorator callbacks are called when a label is interacted with.
In case you have good suggestions in mind how it should work and what the use cases are, I can keep this thread open as a feature request.
Hi AlexExle. I did something similiar to what you are asking.
I created an object with the properties "teams" and "results" but I also added some other properties I needed. I found out that as long as the object you pass to Brackets has "teams" and "results" (with the appropiate structure), you can add to it anything you want. Then when the save function is called. it receives that object with all the properties.
Having that in mind, I added a property TeamIDs with a similar structure to "results". Then when the save function is called I update the TeamIDs array according the the "results" array.