Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-29-2011, 09:36 AM   PM User | #1
saltoceana
New Coder

 
Join Date: Oct 2011
Posts: 37
Thanks: 13
Thanked 1 Time in 1 Post
saltoceana is an unknown quantity at this point
Question Updating a new set of coordinates using ExtJS on CSS

I tried using the following to remove some of my previous CSS declaration so that I can insert new ones but seems to fail.

Code:
Ext.util.CSS.removeStyleSheet(keyname);

The full code

Code:
<script type="text/javascript">
    var puthtml = "";

    var selectedbgcolor = "#FF0F00";
    var place = [];

$(document).ready(function() {

  $(".pressButton").button();
  $(".pressButton").click(function() {

    alert(this.name);
    document.getElementById("new_points").style.backgroundImage="url('" + this.name + "')";

        var allextRules = Ext.util.CSS.getRules();

        Object.keys(allextRules).forEach(function(key) {
            var keyname = key;
            if(keyname.indexOf("Points") != -1){
                Ext.util.CSS.removeStyleSheet(keyname);
                console.log(keyname + " Removed");
            }

         });        


        for(var i=0; i<coords.length; i++){
            if(coords[i][0] = this.name){
                place.push(["NewDot", "#Points" + i + " { background: url('" + yellowdot + "') no-repeat; \n position: absolute; \n top: " + coords[i][2] + "px; \n left: " + coords[i][3] + "px; \n width: " + coords[i][4] + "px; \n height: " + coords[i][5] + "px; \n }", "Entry " + coords[i][6]]);
            }
        }

        puthtml = "";
        for(var i=0; i<place.length; i++){
            Ext.util.CSS.createStyleSheet(place[i][1], place[i][0]);
            puthtml = puthtml + "<div id=\"js" + i + "\"><br><br><div id='text' style='text-align:center; background-color:" + selectedbgcolor + "; border-width: 4px; border-style: solid; border-color: #454545'>" + place[i][2] + "</div></div>";
        }

        var DomHelp = Ext.core.DomHelper;
        var DomQy = Ext.DomQuery;

        var wrap = DomQy.selectNode('#new_points');
        DomHelp.insertHtml('beforeEnd', wrap, puthtml);

  });


});
and the CSS as follows:

Code:
<style type="text/css">
div#new_points {
    background: url('http://hdfreewallpaper.info/assets/hdfreewallpaper/2011/07/25/wall/7574/1280x800/lake-coleridge-new-zealand-1280-x-800.jpg') no-repeat #d2d2d2;
    margin:0 auto;
    /*border:2px solid #9e9e9e;*/
    border:2px solid #000000;
    width:1280px;
    height:800px;
    position: relative;
    overflow: hidden;
}
</style>
Any Insight?
saltoceana is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:16 AM.


Advertisement
Log in to turn off these ads.