I have a Grid template in Kendo UI looking like the following:
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr class="row-template">
<td style="width:80px">
<div rowspan="4"><img src="../../Images/picture_temp.jpg" class="display_searchresults_picture"/></div>
</td>
<td>
<div class="display_searchresults_name">#= FirstName # #= LastName # </div>
<div align="right" width="100px">* * * * *(4.5)</div>
# for (var i = 0; i < Education.length; i++) { #
<div class="display_searchresults_address">#= Address.City #, #= Address.State # | #= Education[i].School.Name #</div>
# for (var j = 0; j < Education[i].Major.length; j++) { #
<div class="display_searchresults_info">#= Education[i].Major[j].Name # | #= Education[i].GraduationDate.Year # | 3.5-3.75</div>
# } #
# } #
<div class="display_searchresults_desc" colspan="2">#= Description #...</div>
</td>
</tr>
This template works like a charm in IE 9, but in Firefox it rendrers as:
#= FirstName # #= LastName #
* * * * *(4.5)
# for (var i = 0; i < Education.length; i++) { #
#= Address.City #, #= Address.State # | #= Education[i].School.Name #
# for (var j = 0; j < Education[i].Major.length; j++) { #
#= Education[i].Major[j].Name # | #= Education[i].GraduationDate.Year # | 3.5-3.75
# } # # } #
#= Description #...
Basically, it renders as code, not as html.
As for Chrome, the grid doesn't get rendered there at all. How can I make Kendo UI Grid template work for other browsers?
Hello your template seems to be working fine. Here is it in action JsBin.
You can check the console to see if there are any JavaScript errors when you are using your data. If any of the fields like Education is not defined it might break the template.
Related
let output = []
for(let x = 0; x<appliances.length; x++){
document.getElementById("parent").innerHTML += `<div class="card" style="width: 18rem;">
<img src="${appliances[x].img_src}" class="card-img-top" alt="...">
<div class="card-body">
${appliances[x].quantity >= 10 ?
'<h5 class= "card-title" style = "color:blue">`${appliances[x].name}` - `₹${appliances[x].price}` </h5>' :
'<h5 class="card-title" style = "color:green">{${appliances[x].name} - `₹${appliances[x].price}` </h5>'}
<p class="card-text">Some quick example text to build on </p>
Go somewhere
</div>
</div>`
Kindly correct me to fix error over the ternary operator condition.Iam expecting to retrieve the name and price that was given in the array object.I am beginner so please help me with this.
Yesterday and today I had quite some fun figuring out how to create an accordion menu with bootstrap css and TypoScript in TYPO3 7.6.*
Since I nearly lost my mind and questioned my brain on the way to it, I am searching for a good solution.
Edit: moved solution to own answer and changed topic start to question
Perhaps you could use fluid for Menu rendering. Here are some examples:
https://github.com/TYPO3/TYPO3.CMS/tree/master/typo3/sysext/fluid_styled_content/Resources/Private/Partials/Menu
Yesterday and today I had quite some fun figuring out how to create an accordion menu with bootstrap css and TypoScript in TYPO3 7.6.*
Since I nearly lost my mind and questioned my brain on the way to it, I want to share you my outcome and would like to get some improvement ideas.
I have a 2 level menu where the first level is only for grouping - not linked - and the second level contains the sub pages
This is the HTML container inside my template:
# HTML part, put into your template
<div class="panel-group" id="accordion">
<f:cObject typoscriptObjectPath="lib.menu2" />
</div>
And this is my TypoScript:
# TypoScript part
lib.menu2 = HMENU
lib.menu2 {
wrap = |
1 = TMENU
1.expAll = 1
1.NO = 1
1.NO.wrapItemAndSub = <div class="panel panel-default">| </table></div></div></div>
1.NO.doNotLinkIt = 1
1.NO.allStdWrap.dataWrap = <div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse{field:uid}"> | </a></h4></div><div id="collapse{field:uid}" class="panel-collapse collapse"><div class="panel-body"><table class="table">
1.IFSUB < .1.NO
1.IFSUB.allStdWrap.dataWrap = <div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse{field:uid}"> | </a></h4></div><div id="collapse{field:uid}" class="panel-collapse collapse"><div class="panel-body"><table class="table">
1.CURIFSUB < .1.NO
1.CURIFSUB.allStdWrap.dataWrap = <div class="panel-heading"><h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion" href="#collapse{field:uid}"> | </a></h4></div><div id="collapse{field:uid}" class="panel-collapse collapse in"><div class="panel-body"><table class="table">
1.ACTIFSUB< .1.CURIFSUB
2 = TMENU
2.NO = 1
2.NO.linkWrap = <tr><td> | </td></tr>
}
I still a small clean up on my todolist, to remove the submenu stuff for NO where there is no submenu.
What do you think?
#firegate666, your solution was inspirational! I've modified to account for:
- subparts (note: also works with fluid, just change ###SUBPART### )
- user-generated full CSS styling (no panels)
- a (minimum) 3 level menu
HTML Template:
<!-- ###MENU### START -->
<!-- ###MENU### END -->
TYPOscript:
# declare the menu,
# wrap it in a list <ul>
# and then wrap all that in a container div (for post-processing menus like slicknav),
subparts.MENU = HMENU
subparts.MENU.wrap = <div id="menu"><ul> | </ul></div>
subparts.MENU {
# 1st level
1 = TMENU
1 {
expAll = 1
# enable the NOrmal state, wrap it in a <li>
NO = 1
NO.wrapItemAndSub = <li> | </li>
# IF item has a SUBmenu, then it's still like a NOrmal item, but more
# wrap it in Bootstrap accordion/collapse functionality
# then close it
IFSUB < .NO
IFSUB = 1
IFSUB.allStdWrap.dataWrap (
<a class="accordion-toggle collapsed" data-toggle="collapse" href="#collapse{field:uid}"> | </a>
<div id="collapse{field:uid}" class="collapse">
<ul>
)
IFSUB.wrapItemAndSub (
<li> | </li>
</ul>
</div>
)
IFSUB.doNotLinkIt = 1
}
# 2nd level sub-menu and 3rd level sub-sub-menu inherit all the properties of 1st level
2 < .1
3 < .1
# end subparts.MENU
}
...and (suggested) CSS:
.accordion-toggle:before {
content: "- ";
}
.accordion-toggle.collapsed:before {
content: "+ ";
}
I hope this addition to your code is helpful :-)
I use typoscript (new to it) to handle the menu bar for my site and I want to use fontawesome icons next to the menu entries.
This is what the model look like:
This is how my menu look like:
Now, my typoscript subpart for menu looks this way:
SUBNAV = HMENU
SUBNAV {
entryLevel = 0
1 = TMENU
1 {
expAll = 1
collapse = active
noBlur = 1
# Definition per page
# NO: default formatting
NO = 1
NO {
wrapItemAndSub = <li >|</li>
stdWrap.wrap = <i class="fa fa-plus"></i><span>|</span>
}
# ACT: User is on this or below this page
# Activate this state for this menu
ACT < .NO
ACT {
wrapItemAndSub = <li class="active">|</li>
}
CUR < .ACT
# try to check if submenu to add a arrow icon
IFSUB = 1
IFSUB{
wrapItemAndSub = <li class="first">|</li>|*|<li>|</li>|*|<li class="last">|</li>
linkWrap = |<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
ATagBeforeWrap = 1
stdWrap.wrap = <i class="fa fa-plus"></i><span>|</span>
}
ACTIFSUB = 1
ACTIFSUB < .ACT
ACTIFSUB.linkWrap = |<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
ACTIFSUB.ATagBeforeWrap = 1
CURIFSUB = 1
CURIFSUB < .ACTIFSUB
}
2= TMENU
2 {
expAll = 1
collapse = active
noBlur = 1
wrap = <ul class="treeview-menu">|</ul>
# Definition per page
# NO: default formatting
NO = 1
NO {
wrapItemAndSub = <li >|</li>
}
# ACT: User is on this or below this page
# Activate this state for this menu
ACT < .NO
ACT {
wrapItemAndSub = <li class="active">|</li>
}
CUR < .ACT
# try to check if submenu to add a arrow icon
IFSUB = 1
IFSUB{
wrapItemAndSub = <li class="first">|</li>|*|<li >|</li>|*|<li class="last">|</li>
linkWrap = |<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
ATagBeforeWrap = 1
}
ACTIFSUB = 1
ACTIFSUB < .ACT
ACTIFSUB.linkWrap = |<span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span>
ACTIFSUB.ATagBeforeWrap = 1
CURIFSUB = 1
CURIFSUB < .ACTIFSUB
}
# Definition for pages on level 3 and lower
# Copy the definitions from level 2
3 < .2
# 3.wrap = <ul class="treeview-menu">|</ul>
# Copy the definitions from level 2
4 < .2
# 4.wrap = <ul class="treeview-menu">|</ul>
# Copy the definitions from level 2
5 < .2
# 5.wrap = <ul class="treeview-menu">|</ul>
# Copy the definitions from level 2
6 < .2
# 6.wrap = <ul class="treeview-menu">|</ul>
}
Now, my problem is I don't know how to associate different icons (which I chose) with different menus (the ones in level 1). As you see in typoscript, I used a fa icon but is same for every menu entry (fa fa-plus).
Any suggestions?
If you have a finite number of menu items you can replace your code:
wrapItemAndSub = <li class="first">|</li>|*|<li>|</li>|*|<li class="last">|</li>
With:
wrapItemAndSub = <li class="first icon1">|</li>|*|<li class="icon2">|</li>|*|<li class="icon3">|</li>|*|<li class="icon4">|</li>|*|<li class="last iconN">|</li>
To control the display of each list item.
Hi I'm very new to C#. But I have this weblist that print out some result, that I'm trying to change, What I'm trying to do is to make an if statement. If row[4] is less then [2] then the row should be red. I have tried to copy some of the code.
//##############Print result##############
foreach ( string[] row in dataResult)
{
//Birn.Util.cellDecimalPrinter(row[0],"#,0.0")
//<tr id="PopUp" onclick="OpenWindow('file.aspx?querystr=row[0]&date=textbox.text','500','300')">
%>
<tr>
<td><%=row[0]%></td>
<td><%=row[1]%></td>
<td><%=row[2]%></td>
<td><%=row[3]%></td>
<td><%=row[4]%></td>
</tr>
<%
}
You can change the style of the row using CSS. I have assumed that whatever you are comparing in rows 2 and 4 is a string representation of a Decimal: adjust the Convert.ToDecimal to the appropriate type if needed:
foreach ( string[] row in dataResult)
{
string redStyle= "";
If (Convert.ToDecimal(row[4]) < Convert.ToDecimal(row[2])) {
// ideally you would have a style defined in a separate CSS file for this
redStyle = " style=\"background-color: Red; color: White\"";
}
}
%>
<tr<%=redStyle%>>
<td><%=row[0]%></td>
<td><%=row[1]%></td>
<td><%=row[2]%></td>
<td><%=row[3]%></td>
<td><%=row[4]%></td>
</tr>
<%
}
I'd like to have a horizontal menu at the top of the website and a vertical menu with the menu levels 2 and 3 at the left side of the website.
Unfortunately my typoscript shows the same menu for both areas.
Any ideas what's wrong?
# Hauptmenu
lib.mainMenu = HMENU
lib.mainMenu.special = directory
lib.mainMenu.special.value = 1
lib.mainMenu.entryLevel = 0
lib.mainMenu.1 = TMENU
lib.mainMenu.1.NO {
wrapItemAndSub = <div class="grid_1_menu"> | </div > |*| <div class="grid_1_menu"> | </div > |*| <div class="grid_1_menu grid_1_menu_end"> | </div >
}
# Seitennavigation
lib.subMenu= HMENU
lib.subMenu.special = directory
lib.subMenu.special.value = 1
lib.subMenu.entryLevel = 1
lib.subMenu.wrap = <ul class="sub-menu" id="menu-level-1">|</ul>
lib.subMenu.1 = TMENU
lib.subMenu.1.NO {
wrapItemAndSub = <li class="first"> | </li> |*| <li class="middle"> | </li> |*| <li class="last""> | </li>
}
lib.subMenu.2 < lib.subMenu.1
lib.subMenu.2.wrap = <ul class="sub-menu" id="menu-level-2">|</ul>
That's easy:
special = directory
special.value = 123
creates a menu from ALL items inserted in page or sysfolder with uid = 123 , by writing the value (1 in your case) you instruct the TS to build menu from pages under (probably) main page.
As you can see in this sample, special directive takes precedens over the entryLevel.
Allthough I don't understand exactly why, I had to remove
lib.subMenu.special.value = 1