kendo: Enable / Disable button in navigation bar - kendo-ui

Below is a definition of the navigation bar, part of a view template that is used among several screens:
<div data-role="layout" data-id="app">
<header data-role="header">
<div data-role="navbar">
<a class="nav-button" data-align="left" data-role="backbutton">Back</a>
<span data-role="view-title">Title</span>
<a class="nav-button" data-align="right" data-role="button" data-click="doneTapped" id="btnDone">Done</a>
</div>
</header>
</div>
The "Done" button is only needed on some screens, so it gets hidden when the main page loads:
$("#btnDone").hide();
Hiding the button works fine, but showing it again does not work:
$("#btnDone").show();
The button does not show up.

Instead of using $("#btnDone").hide(); and $("#btnDone").show(); use:
Hide button:
$("#btnDone").css("visibility", "hidden");
Show button:
$("#btnDone").css("visibility", "visible");

Something that has worked for me in this situation is to put a class on the button I want to show/hide instead of relying on the id:
<div data-role="layout" data-id="app">
<header data-role="header">
<div data-role="navbar">
<a class="nav-button" data-align="left" data-role="backbutton">Back</a>
<span data-role="view-title">Title</span>
<a class="nav-button btnDone" data-align="right" data-role="button" data-click="doneTapped" id="btnDone">Done</a>
</div>
</header>
</div>
And then use the class to hide it:
$(".btnDone").hide();
Hope this works for you as well.

Salam,
Try the following:
<!--Home-->
<div id="tabstrip-home"
data-role="view"
data-init="app.home"
data-title="Home">
<!--Header-->
<header data-role="header">
<div data-role="navbar">
<a class="nav-button" data-align="left" data-role="backbutton">Back</a>
<span data-role="view-title">Title</span>
<a class="nav-button" data-align="right" data-role="button" data-click="doneTapped" id="btnDone">Done</a>
</div>
</header>
<!--Content-->
<div class="view-content">
<h1>Hide / Show Navbar Elements</h1>
<p>
<center>
<a data-align="left" data-role="button" data-click="app.show">Show</a>
</center>
<br />
<center>
<a data-align="left" data-role="button" data-click="app.hide">Hide</a>
</center>
</p>
</div>
</div>
In the data-init="app.home" function you find the navbar, then the leftElement and have references to them then you can control it, Example:
var navbar = null;
var left = null;
global.app.home = function (e) {
navbar = e.sender.header.find('div[data-role="navbar"]').data('kendoMobileNavBar');
left = navbar.leftElement;
console.log(left);
};
global.app.show = function (e) {
left.show();
};
global.app.hide = function (e) {
left.hide();
};
Please see a working example here: http://jsbin.com/EpInoQOq/1/edit
Regards

The way I handled hiding and shwowing the Back Button on different views was to use 2 different Layouts. This worked well for my use case as I only show the back button on 1 page:
<!--Default Layout with Main Menu and no backbutton-->
<div data-role="layout" data-id="layout">
<!--Header-->
<div data-role="header">
<div data-role="navbar">
<span data-role="view-title"></span>
</div>
</div>
<!--Footer-->
<div data-role="footer">
<div data-role="tabstrip">
....
</div>
</div>
</div>
<!--Layout with Back Button-->
<div data-role="layout" data-id="layoutBackButton">
<div data-role="header">
<div data-role="navbar">
<a data-role="backbutton" data-align="left">
<!-- data-bind="isVisible: showBackButton" -->
<i class="fa fa-chevron-left fa-lg"></i>
</a>
<span data-role="view-title"></span>
</div>
</div>
</div>
My Remote View that uses the Back button then specifies the other Layout:
<div data-layout="layoutBackButton"
data-role="view"
...>

Related

How can I display vue.js data in blade

I am doing a small project with vue.js and laravel. I have a list of products, when I click on a specific product on "Quick view" button I want to show all data about that product in a modal but the data is not showing in the modal.
Can you help me please. Here is my code:
#extends('app')
#section('content')
<div id ="crud" class="row">
<div class="col-xs-12">
<h1 class="page-header">Lista de Articulo</h1>
</div>
<div class="wrap-icon right-section col-md-12" data-toggle="modal" data-target="#list" >
<div class="wrap-icon-section wishlist">
<a href="#" class="link-direction">
<i class="fa fa-heart" aria-hidden="true"></i>
<div class="left-info">
<span class="index">0 item</span>
<br>
<span class="title">Wishlist</span>
</div>
</a>
</div>
</div>
<div class="row">
<div v-for="keep in keeps" class="col-md-4" style="width:25%;" #mouseover="showByIndex = keep" #mouseout="showByIndex = null">
<div class="container">
<img :src="keep.foto" style="width:100%; max-width:150px;">
<button class="btn" v-show="showByIndex === keep" v-on:click.prevent="showKeep(keep)">Quick view</button>
</div>
<h3>
<b> #{{keep.nombre}}</b>
</h3>
<p> #{{keep.descripcion}}</p>
I fixed it. The error was because I called the modal file outside the div. Thanks to everybody.
you can't send data directly from vue in blade structure, you need to write a component for that.
https://v3.vuejs.org/examples/modal.html#modal-component

content load dynamically inside quickView/ Popup in larave

I am trying to create an application with laravel and I am having some difficulty in understanding how to dynamically load content into a division according to the button clicked from the product icon.
This is the category page
<div class="row justify-content-center">
#foreach($ProductData as $Product)
<div class="col-6 col-md-4 col-lg-4 col-xl-3">
<div class="product product-7 text-center" title="{{$Product->product_name}}">
<figure class="product-media">
<span class="product-label label-new">New</span>
<a href="product.html">
<img src="{{ asset('images/product/thumbnail/'.$Product->photo) }}" alt="{{$Product->photo}}" class="product-image">
</a>
<div class="product-action-vertical">
<span>add to wishlist</span>
<span>Quick view</span>
<span>Compare</span>
</div><!-- End .product-action-vertical -->
<div class="product-action">
<span>add to cart</span>
</div><!-- End .product-action -->
</figure><!-- End .product-media -->
<div class="product-body">
<div class="product-cat">
Women
</div><!-- End .product-cat -->
<h3 class="product-title">{{$Product->product_name}}</h3><!-- End .product-title -->
<div class="product-price">
$ {{$Product->price}}
</div><!-- End .product-price -->
<div class="ratings-container">
<div class="ratings">
<div class="ratings-val" style="width: 20%;"></div><!-- End .ratings-val -->
</div><!-- End .ratings -->
<span class="ratings-text">(2)</span>
</div><!-- End .rating-container -->
<div class="product-nav product-nav-thumbs">
<a href="#" class="active">
<img src="{{ asset('assets/molla/assets/images/products/product-4-thumb.jpg') }}" alt="product desc">
</a>
<a href="#">
<img src="{{ asset('assets/molla/assets/images/products/product-4-2-thumb.jpg') }}" alt="product desc">
</a>
<a href="#">
<img src="{{ asset('assets/molla/assets/images/products/product-4-3-thumb.jpg') }}" alt="product desc">
</a>
</div><!-- End .product-nav -->
</div><!-- End .product-body -->
</div><!-- End .product -->
</div><!-- End .col-sm-6 col-lg-4 col-xl-3 -->
#endforeach
</div>
**and mypopup/quickView.html, where I want to load data dynamically is bellow: **
<div class="container quickView-container">
<div class="quickView-content">
<div class="row">
<div class="col-lg-7 col-md-6">
<div class="row">
<div class="product-left">
<a href="#one" class="carousel-dot active">
<img src="assets/molla/assets/images/popup/quickView/1.jpg">
</a>
<a href="#two" class="carousel-dot">
<img src="assets/molla/assets/images/popup/quickView/2.jpg">
</a>
<a href="#three" class="carousel-dot">
<img src="assets/molla/assets/images/popup/quickView/3.jpg">
</a>
<a href="#four" class="carousel-dot">
<img src="assets/molla/assets/images/popup/quickView/4.jpg">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
There are two ways you can dynamically load the modal/popup
Store the product details in data-* attribute of quick view button/anchor tag. Have a skeleton Quick View modal. On click of 'Quick View', trigger a javascript function to populate the skeleton modal with the product data fetched from data attributes.
Making AJAX call when user click on 'Quick View' button and populate the skeleton modal with the response data
Going by Approach #1 can you save you multiple network calls to the server as all the product related data (required to be shown in Quick View) is stored as data attributes
Updated
Example for Approach #1
<a class="btn btn-primary btnQuickView" data-product-name="Product Name" data-product-img="http://shop.com/product/image.jpg" data-product-price="200.00">Quick View</a>
Modal code
<!-- Quick View Modal -->
<div id="quickViewModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Title</h4>
</div>
<div class="modal-body">
<h1 id="modal-product-name"></h1>
<img id="modal-product-image" src="">
<p id="modal-product-price"></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Load jQuery library -->
<script type="text/javascript">
$(function(){
$('body').on('click','.btnQuickView', function(e){
e.preventDefault();
var data = $(this).data();
$('#quickViewModal #modal-product-name').html(data.productName);
$('#quickViewModal #modal-product-name').attr('src', data.productImage);
$('#quickViewModal #modal-product-name').html(data.productPrice);
$('#quickViewModal').modal();
});
});
</script>

Problem with image toggle on dynamically loaded Bootstrap collapse panel with nested collapse panel

Can someone help with a dynamically loaded collapse panel with a nested dynamically loaded collapse panel? The issue I'm having is the image toggles for the outer and inner panels. The collapse part is working fine, the image toggle is what I'm having problems with. Here is something similar to what I have. Please forgive any syntax errors, I had to make up an example that is similar to mine.
<div class="container">
#foreach(AccountModel aModel in Model.AccountModels)
{
<div class="panel panel-default">
<div class="panel-heading" data-target="##aModel.Id" data-toggle="collapse" role="button">
<h4 class="panel-title">
<a>
<span class="glyphicon glyphicon-plus"></span>
#aModel.Description
</a>
</h4>
</div>
<div class="panel-collapse collapse" id="#aModel.Id">
<div class="panel-body">
#foreach(TransactionModel tModel in aModel.Transactions)
{
//nested collapse panel
<div class="panel panel-default">
<div class="panel-heading" data-target="##tModel.Id" data-toggle="collapse" role="button">
<h4 class="panel-title">
<a>
<span class="glyphicon glyphicon-plus"></span>
#tModel.Description
</a>
</h4>
</div>
</div>
<div class=panel-collapse collapse" id="#tModel.Id">
<div class="panel-body">
<p>Some details</p>
<p>More details</p>
<div>
<div>
}
</div>
</div>
</div>
}
</div>
<script>
$('.collapse').on('show.bs.collapse', function() {
$(this).parent().find(".glyphicon-plus:first").removeClass("glyphicon-plus").addClass("glyphicon-minus");
stopPropagation();
}).on('hide.bs.collapse', function() {
$(this).parent().find(".glyphicon-minus:first").removeClass("glyphicon-minus").addClass("glyphicon-plus");
stopPropagation();
});
</script>

kendo ui mobile events in templates not fireing

I using this approach for my new app.
http://blogs.telerik.com/blogs/14-03-27/structuring-hybrid-mobile-applications
But I running in a problem with click events when I calling templates in my view.
Everything else like data binding init kendo widgets works fine.
What I missing here?
<div data-role="view" id="home" data-model="APP.home.model" data-init="APP.home.events.init" data-after-show="APP.home.events.afterShow" style="display: none;">
<header data-role="header">
<div data-role="navbar">
<a data-role="button" data-rel="drawer" href="#categories" data-icon="drawer-button" data-align="left"></a>
<span data-role="view-title"></span>
<div data-role="button" data-bind="click: hello" data-align="right" data-icon="compose">a</div>
</div>
</header>
<div>TEST me</div>
<div data-role="button" data-bind="click: hello" data-align="right" data-icon="compose">a</div>
<div id="testMe">
</div>
<div id="home-grid" class="grid home-grid"></div>
</div>
<script>
var events = {
init: function (e) {
navbar = e.view.header.find('.km-navbar').data('kendoMobileNavBar');
var template = kendo.template($("#testMe_tmp").html());
$("#testMe").html(template({}));
kendo.mobile.init($("#testMe"));
},
afterShow: function (e) {
navbar.title("b");
}
};
</script>
Thanks in advance
T.S
I found a solution
after
kendo.mobile.init($("#testMe"));
add this
kendo.bind($("#content"),model);
I don't understand why then I never find a sample source need this.
T.S

Login menu not appearing when created using meteor

I am new to Meteor of course for developing filed as well. I have created a login UI using meteor, but it is not visible. I am able to see through inspect element using console. Can some one tell me what went wrong.
<body>
<div class="container">
{{> header}}
<div id="main" class="row-fluid">
{{renderPage}}
</div>
</div>
</body>
<template name="header">
<header class="navbar">
<div class="navbar-inner">
<a class="brand" href="/">Jobboard</a>
<ul class="nav">
</ul>
<ul class="nav pull-right">
<li>{{loginButtons}}</li>
</ul>
</div>
</template>
You need to close your <header> tag. Use consistent indentation to make these issues more obvious:
<body>
<div class="container">
{{> header}}
<div id="main" class="row-fluid">
{{renderPage}}
</div>
</div>
</body>
<template name="header">
<header class="navbar">
<div class="navbar-inner">
<a class="brand" href="/">Jobboard</a>
<ul class="nav">
</ul>
<ul class="nav pull-right">
<li>{{loginButtons}}</li>
</ul>
</div>
</header>
</template>

Resources