CSS3 PIE Forums
http://css3pie.com/forum/

Have a list of all the items in the Page that has PIE
http://css3pie.com/forum/viewtopic.php?f=4&t=1614
Page 1 of 1

Author:  Balasubramanian [ Tue Mar 27, 2012 12:08 pm ]
Post subject:  Have a list of all the items in the Page that has PIE

Hi All

I have an issue in my project to maintain all the items that have PIE behaviour.
I have a Web 2.0 page so dynamically rendering different part of the page, as a result i have to update the position and size of the pie container after a render happen.

Solution:
I am adding a registory, that holds all the reff of the componets @ init and call the update on all the items

Code:
 PIE[ 'attach' ] = function (el) {
            if (PIE.ieDocMode < 10 && PIE.supportsVML) {
                PIE.Element.getInstance(el).init();
                PIE.Element.setPieIndex(el,PIE._registry.length)
                PIE._registry.push(el)

            }
        };
        /**
         * Programatically detach PIE from a single element.
         * @param {Element} el
         */
        PIE[ 'detach' ] = function (el) {
            PIE._registry.splice(PIE.Element.getPieIndex(el),1)
            PIE.Element.destroy(el);
        };

        PIE['updateAll'] = function () {
            for (var pieIndex = 0, pieLength = PIE._registry.length; pieIndex < pieLength; pieIndex++) {
                PIE.Element.getInstance(PIE._registry[pieIndex]).update()
            }
        }

Author:  Balasubramanian [ Tue Mar 27, 2012 12:31 pm ]
Post subject:  Re: Have a list of all the items in the Page that has PIE

Found another way

Code:
         Element.updateAll = function () {
                if (wrappers) {
                    for (var wrapper in wrappers) {
                        wrappers[wrapper].update()
                    }
                }
            }

and
Code:
        PIE['updateAll'] = function () {
            PIE.Element.updateAll()
        }

Author:  xem [ Wed May 30, 2012 10:17 am ]
Post subject:  Re: Have a list of all the items in the Page that has PIE

You can also remark that all the PIE'd elements get an attribute called "_pieId".
That means you can get that list with a simple jQuery DOM query: $("[_pieId]");

(Also works with Prototype : $$("[_pieId]"); )

once you have this nodeList, you can easily perform attach() and detach() on its members.

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/