jquery-bracket icon indicating copy to clipboard operation
jquery-bracket copied to clipboard

Querying results and triggering events from score updates

Open AlexExle opened this issue 8 years ago • 3 comments

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

AlexExle avatar Aug 30 '16 17:08 AlexExle

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.

teijo avatar Aug 30 '16 21:08 teijo

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.

teijo avatar Aug 30 '16 21:08 teijo

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.

g0nP avatar Oct 07 '16 15:10 g0nP