I have looked at this article by Ventrian and another here in our community. I cannot seem to get this to work, so here is what my module looks like in a nutshell.
View.aspx
<%# Control language="C#" Inherits="KDMC.Modules.kdmc_userTraderListView.View" AutoEventWireup="false" CodeBehind="View.ascx.cs" %>
<%# Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<asp:Panel ID="Panel1" runat="server">
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" OnItemDataBound="traderWorks">
<HeaderTemplate>
<table id="datatable">
<thead>
<tr>
<th>Some heading</th>
</tr>
</thead>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# Eval("SomeData")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SiteSqlServer2 %>" SelectCommand="SELECT Whatever from WHerever"></asp:SqlDataSource>
<script type="text/javascript">
$('#datatable').dataTable();
</script>
<dnn:DnnCssInclude runat="server" FilePath="~/DesktopModules/<modulename>/media/css/jquery.dataTables.css" />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/<modulename>/media/js/jquery.js" />
<dnn:DnnJsInclude runat="server" FilePath="~/DesktopModules/<modulename>/media/js/jquery.dataTables.min.js" />
</asp:Panel>
According to the articles and anytime I have ever plugged css and jquery into a skin file this should work! What is causing DNN not to see it in my module?
Edited
I think I see the issue. I think DNN is seeing the files that are plugged in using the <dnn:DnnCssInclude runat="server> or <dnn:DnnJsInclude runat="server> tags. The module does not see
<script type="text/javascript">
$('#datatable').dataTable();
</script>
How do I fix this? According to this article in our community that it needs to be instantiated. How do I do this?
My guess is the problem is likely due to the relative placement of the various scripts and content. If your using FireFox, you can hit Ctrl-Shift-J to bring up the error console and it will display Javascript errors when you refresh the page.
Anytime you're dealing with Javascript in DNN (or ASP.NET), it's important to look at the rendered code (by doing a view source (Ctrl-U) on the page) so you can see what is actually being generated by the code. Assuming you're using a recent version of DNN (6.x or greater) you shouldn't need to instantiate jQuery but you can verify that by looking at the source and verifying jQuery is being included.
You should verify that your JsIncludes are being rendered before your "$('#datatable').dataTable();" script and that the datatable object is being rendered above the that script as well. If not, you can specify the placement of the JsInclude bits by specifying the provider within the call (i.e. ForceProvider="DnnPageHeaderProvider")
Related
I am building web site using JSF, so that I use Facelets as view technology. Facelets is XHTML+XML based.
Now I want to use AngularJS into my project. I read tutorial here:
http://www.w3schools.com/angular/tryit.asp?filename=try_ng_intro.
<!DOCTYPE html>
<html>
<head>
<script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<div ng-app="">
<p>Input something in the input box:</p>
<p>Name: <input type="text" ng-model="name" value="John"></p>
<p ng-bind="name"></p>
</div>
</body>
</html>
I push above code in to a file test.xhtml. But a warning appears:
Undefined attribute name (ng-app)
How can I modify XHTML so that it understands AngularJS?
The solution is to let JSF insert a pass-through attribute. If you swap <div ng-app=""> with JSF' <h:panelGroup layout="block"> you can give JSF control over that div's attributes:
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
/>
...
<h:panelGroup layout="block">
<f:passThroughAttribute name="ng-app" value=""/>
</h:panelGroup>
...
</html>
See Oracle tutorial, section 8.9.2 Using Pass-Through Attributes.
This warning is coming from the editor, not from JSF. The editor is during validation just thinking that you're brand new to this all and possibly made a mistake, because this attribtue is not recognizable as standard JSF/Facelets. You can safely ignore the warning and run the code straight away. It should run and work fine.
You can reconfigure the editor to not show the warning anymore. You did unfortunately not tell anywhere which editor you're using, so it's merely guessing based on the exact error message. The exact error message is recognizable as the one coming from Eclipse. I can reproduce it here:
Do you notice that Eclipse was so friendly to show quick fixes as well? Pick the one which says "Ignore 'ng-app' attribute in valiation" (or perhaps the one saying 'ng-*' attributes). It'll bring you to Eclipse validation preferences with the excluded attribtues prefilled:
Just click OK and then do a rebuild/revalidate. Now the warning should disappear:
I'm doing a responsive HTML email template for MailChimp and having some peculiar behaviour in Outlook 2003+ on Windows. The template is responsive, but the issues are experienced in desktop, large screen in Outlook. I'm no newcomer to this, and am normally able to get Outlook 2003+ to play nice with my designs, but have run out of ideas in this case.
To provide context, in my approach to responsiveness I've tried both methods described here http://templates.mailchimp.com/development/responsive-email/responsive-column-layouts/ and neither worked in this instance.
The emails render perfectly in all other mail clients and platforms that I've tested.
You can view the HTML here:
Rendered HTML - https://dl.dropboxusercontent.com/u/6136148/mailer-SO.html
Code as .txt - https://dl.dropboxusercontent.com/u/6136148/mailer-SO.txt
The two specific issues I'm experiencing are:
In Outlook only, the right column in the first 'two-column' section, beginning "Twitterverse" is pushed down a huge amount; I can't work out why. I considered the 'MS Word 1800px page-break' issue, but don't think this is what is happening. Do you?
In Outlook only, the three-column 'In Focus' section; the three columns refuse to site inline, regardless of image, table, or td width, when I set it in the HTML, or CSS, or MSOutlook Conditional CSS. Just can't get it to play nice. It seems not to be the padding either.
I am really hoping someone, versed in responsive email design, can import the template to their MailChimp, send a test to themselves in Outlook 2007 or 2013, and let me know what they think.
Download template ZIP - https://dl.dropboxusercontent.com/u/6136148/mailer-SO.zip
Please let me know if I've forgotten to mention anything pertinent. As always, thanks for all your help.
I had this problem and the solution is conditional commenting for mso.
You need to add tables only for Outlook to keep the columns inline.
<!--[if gte mso 9]>
<table align="left" border="0" cellpadding="0" cellspacing="0" width="600">
<tr>
<td align="left" valign="top" width="200">
<![endif]-->
...responsive html code for first column here...
<!--[if gte mso 9]>
</td>
<td align="left" valign="top" width="200">
<![endif]-->
...responsive html code for second column here...
<!--[if gte mso 9]>
</td>
<td align="left" valign="top" width="200">
<![endif]-->
...responsive html code for third column here...
<!--[if gte mso 9]>
</td>
</tr>
</table>
<![endif]-->
Example here: https://litmus.com/community/discussions/277-outlook-2007-2010-3-column-issue
I am running AngularJS 1.2.3 and Bootstrap3 to create a simple task list app.
The code and Bootstrap3 CSS works everywhere (IE11.x, Chrome v31.0.1650.63 m, Opera v18.0.1284.63), except FireFox 25.0.1
If I add the link to bootstrap3 via
<link href="3rdPartyLibs/bootstrap3/css/bootstrap.min.css" rel="stylesheet">
then when AngularJS ng-repeat runs to create the table rows then FireFox v25.0.1 does not render the table header or rows and display them to the user However, if you look at the source, they are being created.
Here's an image of the page and an image of the source:
It should look like this:
FireFox displays this (notice there are no rows):
In FireFox, if I click the [Add New Task] button numerous times, it actually alters the DOM as I expect it to (adding rows to the table), but it doesn't display that to the user. However, the source is altered -- rows are added to the table -- and the source looks like this:
Referencing Bootstrap2 Makes It Work
All I have to do to make it work is reference Bootstrap2 on my machine (i have both locally) by altering the link to : (notice there is no 3 in the bootstrap directory.
<link href="3rdPartyLibs/bootstrap/css/bootstrap.min.css" rel="stylesheet">
After I do that, it works in FireFox too and looks like:
Does bootstrap3 work in FireFox? Is there some special initialization I have to do?
Is Bootstrap3 not ready for prime-time, or is it FireFox?
Figured It Out While Attempting To Convert To Bootstrap2
I decided to convert this thing to work with Bootstrap2 since that would mean all browsers would work. While doing that I discovered that if I simply add a wrapper to my table, then it fixes the problem.
Here's a summary of what I had and what I did:
***note:**If you see unclosed tags, that is bec. it's a summary, please don't try to tell me I need to close those tags. It is valid HTML in the real thing. thanks.*
I had
<html>
<div>
<button1>
<button2>...
</div>
<table>
<thead>
<th>
</thead>
<tbody>
<tr ng-repeat="t in allTasks"
</tbody>
</table>
</html>
I simply wrapped my table in another div and now it works in FireFox. Looks like this:
<html>
<div>
<button1>
<button2>...
</div>
<div>
<table>
<thead>
<th>
</thead>
<tbody>
<tr ng-repeat="t in allTasks"
</tbody>
</table>
</div>
</html>
Now it looks like it should in FireFox
I am developing a application in which one of my template renders a table with n number of rows. Now in each row, i have a column with buttons like edit and delete.
When clicked on edit, a edit form appears in the same window in some div. That form needs to be populated with values fetched from backend.
Now nothing great in this.
My problem is this:
I have a view which renders the complete table using the following template structure:
<script type="text/template" id="ledgersing">
<div class="span6 widget">
<div class="widget-header">
<span class="title">Ledgers</span>
<button class="btn btn-danger pull-right" id="addLedgerButton">Add Ledger</button>
</div>
<div class="widget-content">
<table width="100%" class="table table-striped dataTable">
<thead>
<tr><th>Name</th><th>Email</th><th>Phone</th><th>Action</th></tr>
</thead>
<tbody>
<% _.each(ledgers,function(data){ %>
<tr>
<td><%= data.name %></td>
<td><%= data.email %></td>
<td><%= data.contact_number %></td>
<td><span onClick="alert(<%= data.id %>)">x</span></td>
</tr>
<% }) %>
</tbody>
</table>
</div>
</div>
</div >
</script>
In this it just alerts a id when clicked on x. Now do i need to necessarily use onClick event like this? I mean that i will need the id in whatever construct i use for processing. What can be a better solution? I know backbonejs can handle this mess with ease if application is structured properly.
So essentially i want to know from experts, what will they do in such a scenario. How will they structure the application? I am novice to this frontend framework.
Instead of using _.each in your templates, I'd go with one view per table row as each one has some bit of complexity (edit, delete)
In these view, you use the events hash to register your DOM events. Never use onclick in your HTML, this is a really bad practice.
Don't hesitate to look at the TodoMVC Backbone example for ideas on how to organize your app.
I'm also developing a backbone application for the first time and went thru exactly the same mistake.
I first I just tried to translate my php / asp / ruby / whatever_server_side_template_technology into underscore templates, and got something pretty much like what you had.
Now I can realize it's a mistake. You should use subviews. The events and the associated model will be connected to that subview. Pretty soon you'll have lots of view listening to events and updating themselves when data changes, but if you're carefull it will be ok.
Here's a demo app I'm working on: https://bb-jugar.rhcloud.com/index.html#Wine
and here's the github repo: https://github.com/opensas/BackboneBootstrap
This is how I solved it: https://github.com/opensas/BackboneBootstrap/blob/master/demoapp/js/src/views/crud/RowsView.js
Im currently working with an old version of EPiServer.
In the editor I need to add html like this:
<FORM method=get name=name action=http://somesite.html target=_blank>
<TABLE border=0 cellPadding=5 width=400>
<TBODY>
<TR>
<TD><INPUT name=keywords maxLength=50 size=30><INPUT value=Search type=submit> </TD></TR></TBODY></TABLE></FORM>
This does not work and I think it is because there will be two form tags on the page.
Any ideas?
Edit: More specific: The form tag is of course nested.
This works
<p><input id="someId" type="text" />
<input onclick="window.open('http://somesite.html'+document.getElementById('someId').value)" type="button" value="Search" /></p>
Case closed.....
It's a bad idea to add something in the Editor that isn't supported from the editor toolbar.
But since you are able to save the HTML the answer is in your templates. Most likely your masterpage has a big ASP.NET server FORM enclosing most of the BODY.
All webforms-based pages must have an enclosing form tag which is runat="server" (as stated in previous answers).
Back in the EPiServer 4 days we once did an ugly hack in adding a second form after the ASP.NET runat="server" form and then repositioned it with CSS. This second form cannot contain any asp.net controls that are runat="server".