washingtonstateuniversity / WSU-spine

The spine that binds together wsu.edu
14 stars 7 forks source link

equalizing is not reactive #184

Open quantumJLBass opened 9 years ago

quantumJLBass commented 9 years ago

So I have an issue where I need a .row.equalizing to stay that way even though I ajax'ed in content. The way it was originally set up it didn't account for this, and we talked about it, but now I have need for it myself so I'm bring it up again. We have basicly 3 options as I see it,

  1. set up $.ui.spine.framework.equalizing() as a $.fn so it's callable at will when an ajax response has success, so that the dev has control of when the function fires and the columns are re-equalized.
  2. apply the $.observeDOM() to auto fire the equalizing function for the element that was already done, but has changed.
  3. both 1 & 2 are done, but we provide an option to turn off the auto re-equalization and give the dev back control.

I believe our best option is 3.) and with the rewrite I think I can even shave off about 3-5 lines of code while providing the new functionality. Thoughts?

quantumJLBass commented 9 years ago

It's also worth noting that a dev can already call $('body').spine("equalizing"); and it'll run through all of the items and reapply the equalization, but it's hitting each one, where that is not needed. Now I suppose I could just add an argument to the $.ui.spine.framework.equalizing() which would be optional, but that is odd to write something like $('body').spine( "equalizing", $('#the-area-of-ajax') ); which is how it's work in this framework.

In all technical sense it'd be internally call as I showed above, but the 1.) in the original posting would be to clean it up so you just need to do $('#the-area-of-ajax').equalizing() or $('#the-area-of-ajax').spine("equalizing"); in the thought.

So to wrap it up, there is a new option which is

  1. to just add an argument to $.ui.spine.framework.equalizing() so $('body').spine( "equalizing", $('#the-area-of-ajax') ); is possible to avoid looping through everything.
jeremyfelt commented 8 years ago

I think adding specificity via a second parameter makes sense - $( "body" ).spine( "equalizing", ".class-name" ); or similar.