Google ctemplate repeat a section only sometimes - parsing

We have a section that looks like that ...
{{#PRIZES}}
<div style="text-align: left;TTS={{date}}">{{date}}</div>
<div style="text-align: left;TTS={{sign}}">{{sign}}</div>
<div style="text-align: center;TTS={{number}}">{{number}}</div>
<div style="text-align: right;TTS={{serie}}">{{serie}}</div>
<br>
{{#ADD}}
<div style="text-align: left;TTS={{sign}}">{{sign1}}</div>
<div style="text-align: left;TTS={{number}}">{{number}}</div>
<div style="text-align: right;TTS={{serie}}">{{serie}}</div>
<br>
{{/ADD}}
{{/PRIZES}}
We want that section add looks sometimes 0, or sometimes N for each iteration of Prizes section.
The problem is that I only can repeat ADD section same times for each prizes section.

Related

Adding more than 1 jqGrid to the same view page

I am using asp.net mvc 4 and jqGrid. Is it possible to add more than 1 jqGrid to the same page? if so, could you tell me how? I have two jgGrid, both in the same page, but one appears in one tab and the another in another tab. I have a jquery ui tab. My problem is that only one is shown, the another not. Any ideas what's wrong?
<div id="jqGrid" class="jqGrid">
#Html.Partial("../Grids/_ComponentGrid")
</div>
<div id="jqGridCapsules" class="jqGrid">
#Html.Partial("../Grids/_CapsuleGrid")
</div>
Partial views:
../Grids/_ComponentGrid:
<table id="_componentGrid" cellpadding="0" cellspacing="0">
</table>
<div id="_componentPager" style="text-align: center;">
</div>
../Grids/_CapsuleGrid:
<table id="_capsuleGrid" cellpadding="0" cellspacing="0">
</table>
<div id="_capsulePager" style="text-align: center;">
</div>
I have debugged it with Internet explorer and as I can see, it seems like jqGrid is being applied correctly for first (I post main div, within them there are others divs nested):
<div class="jqGrid" id="jqGrid">
<div class="ui-jqgrid ui-widget ui-widget-content ui-corner-all" id="gbox__componentGrid" style="width: 790px;" dir="ltr">
<div class="ui-widget-overlay jqgrid-overlay" id="lui__componentGrid"/>
<div class="loading ui-state-default ui-state-active" id="load__componentGrid" style="display: block;">
<div class="ui-jqgrid-view" id="gview__componentGrid" style="width: 790px;">
<div class="ui-jqgrid-resize-mark" id="rs_m_componentGrid">
<div class="ui-state-default ui-jqgrid-pager ui-corner-bottom" id="_componentPager" style="width: 790px; text-align: center;" dir="ltr">
</div>
However, for second is not being applied as generated code is:
<div class="jqGrid" id="jqGridCapsules">
<table id="_capsuleGrid" cellspacing="0" cellpadding="0">
<div id="_capsulePager" style="text-align: center;">
as you can see for second, the code generated is completely different from the first. It should be the same as first. So it seems like jqGrid style is not being applied to the second one, Why? What's happening? any ideas, please?

Change order user tabs through div elements

Below is the code I'm using in my ASP MVC view. I'd like the tab order to go from the first to last text box inputs in the fieldsets below in this order:
AgentTypeFields
BasicFields
AddressFields
CommunicationFields
DistributionFields
DRMFields
DSSAgentIds
DSSFields
Right now when the focus of the page is on the first input box of AgentTypeFields, which is the fieldset in the leftDiv of the topDiv. When the user is done tabbing through this fieldset, the focus then shifts to the first input of DistributionFields. Basically I need the tab index to move from the leftDiv fieldsets going from the topDiv, middleDiv, to the bottomDiv, and then back up through the rightDiv elements of the same top/middle/bottom divs.
I've tried puttint a tabindex property on the div and fieldset elements but this simply puts the focus on the element itself, not the inputs contained within it. Not the greatest when it comes to HTML/CSS so any suggests/help would be greatly appreciated. Thanks!
<div id="BigDiv" style="clear:both;">
#Html.HiddenFor(model => model.CreatedDate)
#Html.HiddenFor(model => model.CreatedOperator)
#Html.HiddenFor(model => model.ReferenceNumber)
#Html.HiddenFor(model => model.ReferenceType)
#Html.HiddenFor(model => model.ExtRepType)
#Html.HiddenFor(model => model.Region)
#Html.HiddenFor(model => model.INDDist)
<div id="topDiv">
<div class="LeftDiv" style="width: 450px; float:left;">
<fieldset id="AgentTypeFields" style="width: 400px;">...</fieldset>
</div>
<div class="RightDiv" style="width: 450px; float:left;">
<fieldset id="DistributionFields" style="width: 400px;">...</fieldset>
</div>
</div>
<div id="middleDiv">
<div class="LeftDiv" style="width: 450px; float:left;">
<fieldset id="BasicFields" style="width: 400px;">...</fieldset>
</div>
<div class="RightDiv" style="width: 450px; float:left;">
<fieldset id="DRMFields" style="width: 400px;">...</fieldset>
</div>
</div>
<div id="bottomDiv">
<div class="LeftDiv" style="width: 450px; float:left;">
<fieldset id="AddressFields" style="width: 400px;">...</fieldset>
<fieldset id="CommunicationFields" style="width: 400px;">...</fieldset>
</div>
<div class="RightDiv" style="width: 450px; float:left;">
<fieldset id="DSSAgentIds" style="width: 400px;">...</fieldset>
<fieldset id="DSSFields" style="width: 400px;">...</fieldset>
</div>
</div>
<p>
<input type="submit" value="Save" />
#Html.ActionLink("Back to Search", "Index", "Agent")
</p>
</div>
Put the tabindex on the first field in those fieldsets rather than the fieldset itself. However, this is really going to screw with the blind individuals who come to your site.

How to spread div which is inside content to wider than its content?

Ex. Code below is represented as Blue Box, I want to expand 2 grid to Yellow one. But, the problem is; This .. need to be inside content but it always have margin left and right. I don't know how to solve this.
<div data-role="content" data-theme="d" >
<div class="ui-grid-a" >
<div class="ui-block-a"><strong>Time:</strong></div>
<div class="ui-block-b" id="price-order-timestamp">yyyy-mm-dd hh24:mi:ss</div>
</div>
<div style="width:100%;"> <!-- Here-->
<div class="ui-grid-d" id="data-table-header" >
<div class="ui-block-a">Label A</div>
<div class="ui-block-b">Label B</div>
<div class="ui-block-c">Label C</div>
<div class="ui-block-d">Label D</div>
<div class="ui-block-e">Label E</div>
</div>
<div class="ui-grid-d" id="data-table" >
<div class="ui-block-a">A</div>
<div class="ui-block-b">B</div>
<div class="ui-block-c">C</div>
<div class="ui-block-d">D</div>
<div class="ui-block-e">E</div>
</div>
</div>
</div>
If you want to remove the default padding added to the data-role=content tag, add the following override in your custom.css
#myPageId .ui-content{
padding-left:0;
padding​-right:0;
}​
http://jsfiddle.net/nirmaljpatel/LW5aC/

Jquery-Mobile: How to get the text of the date box using ID

I am new to Jquery-Mobile date box. I want to get the text from the date field using the ID and set that text in the table. But I am not getting it. Please, can anybody help me?
code
<div data-role="page" id="Goal_Weight_Screen">
<div data-role="header" data-theme="b" >
<h1>Goal Count</h1>
</div>
<div data-role="content">
<div data-role="fieldcontain">
<label for="mydate">Choose Start Date</label>
<input name="mydate" id="mydate" type="date" data-role="datebox"
data-options='{"mode": "datebox","disableManualInput": true}'>
</div>
Submit
</div>
</div>
<div data-role="page" id="Calorie_Tracker">
<div data-role="header" data-theme="b" >
<h1>Calorie</h1>
</div>
<div data-role="content" id="table">
<table id="calorie_table" border="1">
<tr>
<th>Date</th>
<th>Food</th>
</tr>
<tr>
<td id="date1">'+$('#mydate').val()+'</td>
<td id="FI_1"></td>
</tr>
</table>
</div>
</div>
You should write a <script> tag and use the JQuery-Mobile method pageshow. Try something like this:
<script type="text/javascript">
$('#Calorie_Tracker').live('pageshow', function(event, ui){
$('#date1').val($('#mydate').val());
});
</script>
Try this. It gives me some weird error but you can see an alert with the date. I hop it will work in you application.

jQueryUI icons in table cells

I'm using jQuery UI icons in a table and they take up the size of the table cell, which is elongated horizontally.
Q: What html/css is necessary to make the icon have the same width as it's height?
Here's what I have so far:
<td class="delete">
<div class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-circle-minus"></span>
</div>
</td>
If the result you are expecting is the icon wrapped in a rounded box then you have to do set the container div a width of 16px, like here:
http://jsfiddle.net/marcosfromero/n2tYP/
#wanted .delete div {
width: 16px;
}
Not entirely sure if this is what you want, but maybe you need to set the behaviour of the div so that it does not fill 100%. Like this:
<table>
<td class="delete">
<div class="ui-state-default ui-corner-all" style="display:table">
<span class="ui-icon ui-icon-circle-minus"></span>
</div>
</td>
</table>
The div's display style is changed so that it does not scale to full width.
I can't tell if you want a jQuery specific answer or just a css answer. Since I don't know the former here's the latter. If you want to limit the width to known pixels and have the height adjusted so that it maintains the proper aspect ratio, a style like
img{width=32px; height= auto;}
should do the trick. Since most icons are square and of known size I would think
img{width=32px; height=32px;}
would work out too.
I don't understand. Are you sure some other CSS in your page isn't causing this problem?
jQuery UI CSS uses the background-image property to display images, and generally those images shouldn't be "taking up the size" of its parent.
I put together a quick jsFiddle with the following contents:
Dependencies:
jQuery 1.5.1
jQuery UI 1.8.9
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/ui-lightness/jquery-ui.css
HTML:
<table>
<tr>
<td class="delete">
<div class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-circle-minus"></span>
</div>
</td>
<td class="delete">
<div class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-arrowthick-1-w"></span>
</div>
</td>
</tr>
</table>
<br />
<table>
<tr>
<td class="delete">
<div class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-circle-minus"></span>
Hello
</div>
</td>
<td class="delete">
<div class="ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-arrowthick-1-w"></span>
world!
</div>
</td>
</tr>
</table>
CSS:
/* Extend the width ... */
td.delete { width: 100px; }
And it came out looking fine in Google Chrome:
Is there a particular browser this is happening on for you? Can you provide a concrete example?

Resources