Welcome Guest, Not a member yet? Register   Sign In
Dojo with CI Help needed
#1

[eluser]Mistry007[/eluser]
Hi everyone, I am trying to implement dojo with CI, I have implemented it. Now i want to do something like add new tab and on that tab i have to attach the view files. following are my code for tab generation
Code:
<!DOCTYPE HTML>
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta charset="utf-8"&gt;
&lt;title&gt;Demo: Layout with StackContainer&lt;/title&gt;
&lt;style&gt;
html,body {
height: 100%;
margin: 0;
overflow: hidden;
padding: 0;
}

#appLayout {
height: 100%;
}

#leftCol {
width: 28em; # formattingTable { border : 0;
border-spacing: 0;
}

#contentContainer {
padding: 2em;
}

#navMenu { /* make the sidebar menu blend in with the whole sidebar */
border: none;
}
&lt;/style&gt;

&lt;link rel="stylesheet" type="text/css"
href="&lt;?php echo base_url() ?&gt;theme/library/dojo_v171/dijit/themes/claro/document.css" /&gt;

&lt;link rel="stylesheet" type="text/css"
href="&lt;?php echo base_url() ?&gt;theme/library/dojo_v171/dijit/themes/claro/claro.css" /&gt;
&lt;!-- load dojo and provide config via data attribute --&gt;


[removed][removed]

[removed][removed]
[removed][removed]
[removed]
  
   dojo.require("dojo.parser");
   dojo.require("dijit.layout.BorderContainer");
   dojo.require("dijit.layout.StackContainer");
   dojo.require("dijit.layout.StackController");
   dojo.require("dijit.layout.ContentPane");
   dojo.require("dijit.layout.TabContainer");

   dojo.require("dijit.dijit"); // optimize: load dijit layer

   dojo.require("dijit.Menu");
   dojo.require("dijit.MenuItem");
   dojo.require("dijit.PopupMenuItem");
   dojo.require("dijit.CheckedMenuItem");
   dojo.require("dijit.MenuSeparator");

   dojo.require("dijit.MenuBar");
   dojo.require("dijit.MenuBarItem");
   dojo.require("dijit.PopupMenuBarItem");

   dojo.require("dijit.layout.AccordionContainer");
  [removed]
[removed]
   function hiren()
   {
    targetUrl = sitepath +"dojocontroller/hiren/";
    [removed].href = targetUrl;
   }

   function changetab()
   {
    var tab = dojo.byId("hello"),
    contentStack1 = dojo.byId("hello1");
    dojo.place(hello1,hello,"");
   }

   function destroyAll(){
       dojo.empty("contentStack");
   }

   function addTab(name) {
    var pane = new dijit.layout.ContentPane({
      title: name,
      closable :true,
      content:'<div>Dharmik</div>'
      
      
    });
    dijit.byId("contentTab").addChild(pane);
   }

   dojo.ready(function(){

   });  

  function home()
  {
   targetUrl = sitepath +"home/jignesh/";
   [removed].href = targetUrl;
  
  }
  function redirect()
  {
   targetUrl = sitepath +"login/logout/";
   [removed].href = targetUrl;
  }
     [removed]
&lt;/head&gt;
&lt;body class="claro"&gt;
<div id="appLayout" class="demoLayout"
  data-dojo-type="dijit.layout.BorderContainer"
  data-dojo-props="liveSplitters:false, design: 'sidebar'">
  &lt;!--  Header Start here --&gt;
  &lt;?php $this->load->view('header');?&gt;
  &lt;!--  Header End herer --&gt;
  &lt;!-- Center start here--&gt;
  &lt;?php $this->load->view($files);?&gt;
  &lt;!--  Center End here --&gt;
  &lt;!-- Left Start here --&gt;
  &lt;?php $this->load->view('left');?&gt;
  &lt;!--  Left end here --&gt;
</div>
&lt;/body&gt;
&lt;/html&gt;
Now the problem is tab is generated but i have to load the view folder file on new tab generation . or i can say that i want to display some button and html element on the newly generated tab . can any one tell me how to do that.
any help will be appriciated.
#2

[eluser]Jason Stanley[/eluser]
Can you describe your problem some more?

As I understand it your view file is in the views folder? So you need a url like this to call it?

Quote:site_path/app/views/viewfile.php

Is this correct?

To get around this you could just call a controller.

Quote:site_path/util/view/viewfile

Code:
class Util extends CI_Controller {
  public function view($file) {
    $valid_files = array('a', 'b');
    if (in_array($file, $valid_files)) {
      $this->load->view($file);
    }
  }
#3

[eluser]Mistry007[/eluser]
you are right but I want to do
Code:
function addTab(name) {
    var pane = new dijit.layout.ContentPane({
      title: name,
      closable :true,
      href: 'one.html'
      
    });
    dijit.byId("contentTab").addChild(pane);
   }

look at the above code it will give me perfect output without refreshing page it will include the one.html file to my tab container content. but i want to include the view folder's file over here.
Can you help me
Thanks,
#4

[eluser]Mistry007[/eluser]
Problem solved with following code...
Code:
function addTab(name)
   {
    targetUrl = sitepath +"home/addtab/";
    var pane = new dijit.layout.ContentPane({
     title: name,
     closable :true,
     href:targetUrl,
     selected:true
    });
    dijit.byId("contentTab").addChild(pane);
    
   }
I have set the targetUrl and in that i have set the controller mathod which will handle the view file..... Now in controller the following code.
Code:
function addtab()
{
     $this->load->view('addmodule');
}
Thanks...




Theme © iAndrew 2016 - Forum software by © MyBB