Kendo Listview + Kendo DataSource + Template - kendo-datasource

I have a listview template with a button on it. I have bound an click event from the html declaration.
<div data-role="listview" class="app-area-listview"
data-template="template"
data-bind="source: dataList"> </div>
<script type="text/x-kendo-tmpl" id="template">
<div class="col-md-3">
<div class="col-md-8">
<h4>#:Name#</h4>
</div>
<div class="col-md-1">
<div class="edit-buttons">
<button data-toggle="button" data-bind="click:onEdit" class="btn btn-white btn-lg ">
</button>
</div>
</div>
</div>
</script>
In the view model I have "onEdit" function.
If I bind "dataList" property as a JSON array, this function on the view model will trigger without any issue, but If I bind a kendo datasource it cannot find the function.
If any one of you have understanding how this get to work, would be a great help.
Thank you.

Probably there is problem with scope. Try debug it and check scope of template.
<script type="text/x-kendo-tmpl" id="template">
#debugger;#
.
.
.
</script>

use following code instead of yout code
<script type="text/x-kendo-tmpl" id="template">
<div class="col-md-3">
<div class="col-md-8">
<h4>#:Name#</h4>
</div>
<div class="col-md-1">
<div class="edit-buttons">
<button data-toggle="button" onclick="onedit(e)" class="btn btn-white btn-lg ">
</button>
</div>
</div>
</div>
</script>

Related

Selenium "get elements inside another element" in nodejs

I'm trying to click in the third input box but I can't use a xpath [3] because it's isolated by divs. How can I get the third "div class price filter" and then get the input?
<div class="search-prices">
<div class="search-price-header">
<h1>Bid Price:</h1>
<button class="flat camel-case disabled" disabled="">Clear</button>
</div>
<div class="price-filter">
<div class="info"><span class="label">Min:</span></div>
<div class="ut-numeric-input-spinner-control">
<button class="btn-standard decrement-value disabled" disabled=""></button>
<input type="tel" class="numericInput" placeholder="Any">
<button class="btn-standard increment-value"></button></div>
</div>
<div class="price-filter">
<div class="info"><span class="label">Max:</span></div>
<div class="ut-numeric-input-spinner-control">
<button class="btn-standard decrement-value disabled" disabled=""></button>
<input type="tel" class="numericInput" placeholder="Any">
<button class="btn-standard increment-value"></button></div>
</div>
<div class="search-price-header">
<h1>Buy Now Price:</h1><button class="flat camel-case disabled" disabled="">Clear</button>
</div>
<div class="price-filter"></div>
<div class="info"><span class="label">Min:</span></div>
<div class="ut-numeric-input-spinner-control">
<button class="btn-standard decrement-value disabled"disabled=""></button>
<input type="tel" class="numericInput" placeholder="Any">
<button class="btn-standard increment-value"></button></div>
</div>
<div class="price-filter">
<div class="info"><span class="label">Max:</span></div>
<div class="ut-numeric-input-spinner-control">
<button class="btn-standard decrement-value disabled"disabled=""></button>
<input type="tel" class="numericInput" placeholder="Any">
<button class="btn-standard increment-value"></button>
</div>
</div>
</div>
I tried something like
var priceFilter = driver.findElement(By.xpath("//div[#class='price-filter'][3]"));
var numericInput = priceFilter.findElement(By.xpath("//input[#class='numericInput']"))
numericInput.click();
But my click always happens in the first input, any idea why?
Try this and let me know whether this works or not.
var numericInput =priceFilter.findElement(By.xpath("(//input[#class='numericInput'])[3]"))
numericInput.click();
Try this xpath: (//div[#class='price-filter']//input)[3]
The xpath that works for me is:
//div[#class='price-filter'][3]//input[#class='numericInput']
thank you guys!

How to use sidebar and main content in express handlebars with a layout

I have a express handlebar application with main.hbs as the layout file.
//main.hbs
<html>
<head></head>
<body>
{{> header}}
{{{body}}}
<script src='/js/jquery-2.2.4.min.js'></script>
<script src='/js/bootstrap.min.js'></script>
</body>
</html>
When i click a link let's say "settings" in dashboard page then it redirects to settings page where i have sidebar and main content page.
This page also uses main.hbs as layout.
//settings.hbs
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active">Account<span class="sr-only">(current)</span></li>
<li>Views</li>
<li>Users</li>
<li>Sites</li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<ol class="breadcrumb">
<li class="active">Settings</li>
</ol>
<div id="settingsContainer">
//Content should be rendered here just like the {{{body}}}
</div>
</div>
</div>
So how can i able to render the desired content inside the "settingsContainer".
As per my understanding in layout file {{{body}}} is used as a placeholder for where the main content should be rendered.
But this is a different page. Is there a way i can render the content based on the link clicked from sidebar.
Any help and pointer will be much appreciated!
i don't know much about handlebars but you can achieve the same with bootstrap tabs.
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<div class="tabbable">
<ul class="nav nav-sidebar">
<li class="active">Account<span class="sr-only">(current)</span></li>
<li class="">Views</li>
</ul>
</div>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<ol class="breadcrumb">
<li class="active">Settings</li>
</ol>
<hr>
<div id="settingsContainer">
<div class="tabbable">
<div class="tab-content">
<div class="tab-pane active" id="account">
//render partial for account
</div>
<div class="tab-pane" id="views">
//render partial for views
</div>
</div>
</div>
</div>
</div>
</div>
Hope this helps

Better Search box for wordpress

Please take a look on this WordPress theme, when you click on search icon, a search box appear in the middle of page with a cool effect. I want to add this to my WordPress site. I have looked on google but still no luck,
Please suggest me a plugin or article.
Thanks
Hi There it work like this using bootstrap modal popup.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Search
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Search</h4>
</div>
<div class="modal-body">
<?php get_search_form(); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

content of ion-content go inside ion-header-bar

I am new to ionic framework. When I use ion-content like this
<ion-view>
<ion-header-bar class="bar bar-header bar-positive">
<div class="buttons">
<button class="button" ng-click="doSomething()">Left Button</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">Right Button</button>
</div>
</ion-header-bar>
<ion-content class="has-header">
<div class="row">
<div class="col">
<i class="fa fa-university"></i>
</div>
<div class="col">.col</div>
<div class="col">.col</div>
</div>
<div class="row">
<div class="col">.col</div>
<div class="col">.col</div>
<div class="col">.col</div>
</div>
</ion-content>
</ion-view>
First row go inside header bar. What's the problem?
I've used requirejs to load controller .
I didn't inject ionic module during bootstraping.
After inject ionic in module this problem solved.

CMSMS does not display html code in edito

I have a very weird problem with CMSMS. I have some HTML in my header file, there should be 2 links, but every time I paste a second one and click Apply- it disappears from editor. Although it shows on website.
CMSMS version: 1.11.9
<div class="header">
<div class="container">
<div class="row-fluid">
<div class="logo_wrapper">
<div class="logo"><img src="{root_url}/ui/images/logo.png" alt="" /></div>
</div>
<div class="span6 pull-right">{if $sid == 1 }
<div class="kabinet pull-right"><a class="rounded" href="apps/customer/web/profile/edit"> Профиль</a></div>
{else}
<div class="kabinet pull-right"><a class="rounded dark" href="#"> Статус доставки</a> <a class="rounded" href="apps/customer/web/login"> Личный кабинет</a></div>
{/if}</div>
</div>
<hr />
<div>
<div class="nav">
<div class="nav-inner">{menu loadprops=0}</div>
</div>
</div>
</div>
</div>
It should be after save:
<div class="header">
<div class="container">
<div class="row-fluid">
<div class="logo_wrapper">
<div class="logo"><img src="{root_url}/ui/images/logo.png" alt="" /></div>
</div>
<div class="span6 pull-right">{if $sid == 1 }
<div class="kabinet pull-right"><a class="rounded" href="apps/customer/web/profile/edit"> Профиль</a>
(this link keeps disappearing)
<a class="rounded no-bg-color" href="apps/customer/web/logout"><i class="icon-off icon-white"></i></a>
</div>
{else}
<div class="kabinet pull-right"><a class="rounded dark" href="#"> Статус доставки</a> <a class="rounded" href="apps/customer/web/login"> Личный кабинет</a></div>
{/if}</div>
</div>
<hr />
<div>
<div class="nav">
<div class="nav-inner">{menu loadprops=0}</div>
</div>
</div>
</div>
</div>
It's probably the HTML editor (MicroTiny I expect) believing that link is invalid HTML and throwing it away.
Set the editor to HTML mode so that you can edit the HTML directly (not WYSIWYG). It will then accept your edits and not try to edit them.

Resources