Imported data not display - 2sxc

Imported data not displays in repeated table. It's only shows demo data. below is my template.
#{
<table class="table table-striped table-bordered">
<tbody>
#foreach (var Content in AsDynamic(Data["Default"]).OrderBy(m => m.wcName))
{
<tr>
<td width="30%">#Content.wcName </td>
<td>#Html.Raw(#Content.wcPosition)
#if (DotNetNuke.Common.Globals.IsEditMode())
{
#Content.Toolbar
}
</td>
</tr>
}
</tbody>
</table>
}

Your template only shows items assigned to this page/module, not "all data" - for that you would have to replace Data["Default"] with App.Data["your-content-type-name"].
You probably want to read more about this here: http://2sxc.org/en/blog/post/12-differences-when-templating-data-instead-of-content

Related

HtmlAgilityPack - Stripping entire table of html attributes isn't working

I'm trying to remove all attributes (class, id and so on) from an HTML table I'm scraping.
So for example, the value for html would be the following:
<table id="tablepress-29" class="tablepress tablepress-id-29">
<thead>
<tr class="row-1 odd">
<th class="column-1">1</th>
<th class="column-2">2</th>
<th class="column-3">3</th>
</tr>
</thead>
<tbody class="row-hover">
<tr class="row-2 even">
<td colspan="3" class="column-1">
<span id="testing---id">
<h2><b>Testing</b></h2>
</span></td>
</tr>
</thead>
</table>
My C#, using HTML Agility Pack is the following:
var doc = new HtmlDocument();
doc.LoadHtml(html.ToString());
var table = doc.DocumentNode.SelectSingleNode("//table");
table.Attributes.Remove("class");
table.Attributes.Remove("id");
var final = table.OuterHtml;
Which strips the first line from
<table id="tablepress-29" class="tablepress tablepress-id-29">
to
<table>
However, it ignores the rest of the code.

#each helper to populate a table

I'm fairly new to meteor and I'm trying to iterate over a cursor using #each to populate a table. Here's my code:
<template name="choral">
<div class="container" style="padding-top: 25px">
<div class="table-responsive">
<form id="orderForm">
<table class="table table-borderless table-dark">
<thead class="thead-light">
<tr>
<th>Title:</th>
<th>See the Music:</th>
<th>Hear the Music:</th>
<th>Format:</th>
<th>Price (per copy):</th>
<th>Quantity:</th>
</tr>
</thead>
<tbody>
{{#each piece in pieces}}
<tr>
<td id="name">{{piece.name}}</td>
<td id="pdf">PDF</td>
<td id="audio">AUDIO</td>
<td id="format">FORMAT</td>
<td id="price">{{piece.score}}</td>
<td id="qty"><input type ="number" name ="quantity" min="5"></td>
</tr>
{{/each}}
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td><button class="button" type ="submit">Add to Cart</button></td>
</tr>
</tfoot>
</table>
</form>
</div>
</div>
my js.
Template.choral.helpers({
pieces: function(){
return choralm.find({});
}
});
I'm outputting a blank row between the #each tag. I publish the collection server side and subscribe. I'm just not sure where to look. Any ideas?
My publishment and subscription:
Meteor.publish('choralList', function() {
return choralm.find();
});
Template.choral.onCreated( function(){
Meteor.subscribe('choralList');
});
As far as I can see you are subscribing to your data but you are not "telling" your template, that the subscription is finished and it should redraw.
Therefore your template immediately renders while the subscription is ongoing and thus uses the yet empty collection data.
In order to inform your template that data has been updated you can use it's internal Tracker and store the information in a reactive data-source (for my example I use ReactiveDict instead of ReactiveVar).
import { ReactiveDict } from 'meteor/reactive-dict';
Template.choral.onCreated( function (){
// inside onCreated, this refers to the
// current template instance
const instance = this;
// let's attach a ReactiveDict to the instance
instance.state = new ReactiveDict();
// use the internal Tracker
instance.autorun(() => {
// subscribe and store a flag, once ready
const choralListSub = Meteor.subscribe('choralList');
if (choralListSub.ready()) {
instance.state.set('subscriptionComplete', true);
}
});
});
Next you add a helper, that returns the reactive value for 'subscriptionComplete':
Template.choral.helpers({
pieces(){
return choralm.find({});
},
subscriptionComplete() {
// we use 'state', our ReactiveDict,
// which we added as prop in onCreated
return Template.instance().state.get('subscriptionComplete');
}
});
And finally we let our template draw the data, once our subscription is complete. Until the subscription is complete (note the {{else}} block), we display a message about the loading status:
<template name="choral">
<div class="container" style="padding-top: 25px">
{{#if subscriptionComplete}}
<div class="table-responsive">
<form id="orderForm">
<table class="table table-borderless table-dark">
<thead class="thead-light">
<tr>
<th>Title:</th>
<th>See the Music:</th>
<th>Hear the Music:</th>
<th>Format:</th>
<th>Price (per copy):</th>
<th>Quantity:</th>
</tr>
</thead>
<tbody>
{{#each piece in pieces}}
<tr>
<td id="name">{{piece.name}}</td>
<td id="pdf">PDF</td>
<td id="audio">AUDIO</td>
<td id="format">FORMAT</td>
<td id="price">{{piece.score}}</td>
<td id="qty"><input type ="number" name ="quantity" min="5"></td>
</tr>
{{/each}}
</tbody>
<tfoot>
<tr>
<td colspan="5"></td>
<td><button class="button" type ="submit">Add to Cart</button></td>
</tr>
</tfoot>
</table>
</form>
</div>
{{else}}
<div>Loading template...</div>
{{/if}}
</div>
</template>
Related resources
TemplateInstance.autorun
http://blazejs.org/api/templates.html#Blaze-TemplateInstance-autorun
https://docs.meteor.com/api/tracker.html
Reactive stores
https://guide.meteor.com/data-loading.html#stores
Subscription readyness
https://guide.meteor.com/data-loading.html#readiness
Helpers
http://blazejs.org/guide/spacebars.html#Built-in-Block-Helpers

JQuery DataTables warning

I am using jquery datatables in my MVC ASP.Net application and get an alert warning while the application is running. The alert is "Warning: Scroller requires DataTables 1.10.0 or greater". I have verified that my version of DataTables is 1.10.10 and the DataTables work fairly well except for a few issues.
My issues with DataTables is when pages using it initially load, the number of rows that are supposed to be displayed do not match how many are shown. All rows are shown on a page load. Once I interact with the table, everything is fixed.
I am loading the javascript and css in my BundleConfig.cs file.
One of my views is as follows:
#model IEnumerable<Q5.ViewModels.ProjectVM>
#{
ViewBag.Title = "Projects";
}
<h2>Projects/Deals</h2>
<p>
#Html.ActionLink("Create New", "Create")
</p>
<table class="table table-striped table-hover display" id="projects" cellspacing="0">
<thead>
<tr>
<th>
#Html.DisplayNameFor(model => model.Name)
</th>
<th>
#Html.DisplayName("Last Updated")
</th>
<th>
#Html.DisplayName("Sales Person")
</th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td>
#Html.ActionLink(item.Name, "ProjectProfile", new { id = item.Id })
</td>
<td>
#Html.DisplayFor(modelItem => item.LastUpdated)
</td>
<td>
#Html.DisplayFor(modelItem => item.AssignedToUserName)
</td>
</tr>
}
</tbody>
</table>
<script>
$(document).ready(function () {
$('#projects').DataTable();
})
</script>
You could have the table refreshed after load:
$('#example').dataTable( {
"initComplete": function(settings, json) {
alert( 'DataTables has loaded.' );
$('#example').dataTable().ajax.reload( null, false );
}
} );
This may not be 100% syntax, just typed off the cuff. I seem to remember having to do this for a project, but the details escape me. I never could figure out why it happened so I slapped this band aid on it.

Thymeleaf. Building table from array & list

I got this code:
<th:block th:if="${!#lists.isEmpty(partyInfoByUploaderList)}" th:each="pInfo : ${partyInfoByUploaderList}">
<h4 th:text="${pInfo.getCharName()}"></h4>
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th:block th:if="${!#lists.isEmpty(pInfo.getCharColumnTitles())}" th:each="title: ${pInfo.getCharColumnTitles()}">
<td th:text="${title}"></td>
</th:block>
</tr>
</thead>
<tbody>
<tr>
<th:block th:each="val: ${pInfo.getCharColumnValues()}">
<td th:text="${val}"></td>
</th:block>
</tr>
</tbody>
</table>
And I got this result:
http://screenshot.ru/6dfbe559f905a17dff44d360b5d13f28
So this code correctly create table head, and dont parse table body.
BTW, after delpoy this code appear at another place:
<th:block th:each="val: ${pInfo.getCharColumnValues()}">
<td th:text="${val}"></td>
</th:block>
Web source code in browser:
http://screenshot.ru/9d3fab8030c5ca382ab81094e0c1ca86
Question #2:
Why this code produce TemplateProcessingException error?
P.S. Not enough reputation for images, so just links. Soz
According to Thymeleaf Documentation, <th:block></th:block> should wrap <tr></tr> and not the opposite. So you should try this :
<th:block th:each="val: ${pInfo.getCharColumnValues()}">
<tr>
<td th:text="${val}"></td>
</tr>
</th:block>

Printing dynamic content with page breaks in asp.net

In my asp.net project I need to print a page with some dynamic content.I followed this article http://www.dotnetcurry.com/ShowArticle.aspx?ID=92 to achieve that and it works fine as long as the content I need to print fits in one page.
But in case of lengthy content, when I click on print button I see a print preview with all the content that needs to be printed and when printed it just prints the content that fits into one page.So I think when I call 'window.print()' it just prints whatever that can fit into a page and does not check if there is anymore content left to print on another page.And I am not sure how do I set the page breaks to get the entire content printed,as it is dynamic content.
Could someone please help me with this?
Thanks
Edit:
Here is some sample HTML rendered.
<table class="Main">
<tr>
<td class=”left bold”>
Some text
</td>
<td>
<span id="Label">Label</span>
</td>
</tr>
<tr>
......
......
</tr>
......
......
......
<tr>
<td>
<table class= “productslist”>
<tbody>
<tr>....</tr>
<tr>....</tr>
<tr class=”productTextAlign”> ......</tr>
<tr class=”additionalOptions”> ..... </tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr>...</tr>
<tr class=”productTextAlign”></tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
<tr class=”additionalOptions”>.....</tr>
</tbody>
</table>
</td>
<tr>
</table>
the table with class is 'Main' is a html table and inside that there is another table with class 'productslist' which is actually a repeater. I am trying to apply the 'page break before' to this repeater using
table.productslist
{
page-break-before:auto;
}
which doesnt to work in FF6.0 and it seems to work fine in IE8.
You could use an Active X control for this:
http://www.meadroid.com/scriptx/docs/printdoc.asp
Alternatively you could take a CSS approach:
http://davidwalsh.name/css-page-breaks
https://stackoverflow.com/search?q=css+page+break

Resources