javascript - Creating new windows when using backbone.js and jQuery -


Currently I'm creating a dialog box using jQuery and populating it using the spinal cord :

  $ ("#" + DialIid) .html (New MyView ({Model: MyModels}) .l); $ ("#" + DialogID) Dialliog ({width: 950, height: 500, auto open} true, dialog class: dialid, status: {my: "center", at: "center", of: window}, close: function (event, UI) {$ (This) .remove ();}, Title: "My Dialogue"});   

What I want to do, is creating a new window so that users can transfer it more liberally, so I tried:

  var = Window open (); Var HTML = $ ("#" + dialogID) .html (); $ (W.document.body) .html (New MyView ({Model: MyModels}) .l);   

It almost works I lose my style and some functionality is lost. Can someone suggest how to fix this snippet so that my style and functionality can be restored? (For example, my data table styles have gone and some contacts with elements in the original window).

Thank you!

I can suggest two possible solutions to you:

1. Create a new path in your app back end, which will generate html pages with just the required script and style and you did this even after doing this but winsow.open ('yournewroute') .

2. Use the method described. It looks like plain javascript

  var w = window.open (''); W.document.write (' gt; & lt; head & gt; & gt; Title & gt; Dialog & lt; / title & gt; & lt; link rel = "stylesheet" type = "text / Css "href =" styles.css "> gt; & gt; & gt; & lt; body & gt; '); W.document.write (new MyView ({Model: MyModels}) .l); W.document.write ('& lt; / body & gt; & lt; / html & gt;');  

Update

Select all the JavaScript import tags in the document:

  var $ JavascriptTags = $ ('script [type = "text / javascript"]'); $ (W.document.head) .append ($ javascriptTags);   

with stylesheets:

  var $ stylesheetTags = $ ('link [rel = "stylesheet"]'); $ (W.document.head) .append ($ stylesheetTags);    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -