I have the following code. What I am doing is to show data and then I have a delete button.
I cannot get the jquery dialog box to come up. I am not sure what I am doing wrong.
#model data_Input
<script src="#Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="#Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<div data-role="page" data-theme="b">
<div id="main" data-role="content">
<div style = "padding-bottom: 10px; padding-top: 20px" class="editor-label">
#Html.Label("Type"): #Html.DisplayFor(m => m.data_Name)
</div>
<div class="editor-label">
#Html.Label("Value"): #Html.DisplayFor(m => m.Date)
</div>
<p>
Open dialog
</p>
</div>
</div>
<!-- Start of second page -->
<div data-role="page" id="dialog">
<div data-role="header">
<h1>
Bar
</h1>
</div><!-- /header -->
<div data-role="content">
<p>
I'm second in the source order so I'm not shown as the page initally.
</p>
<p>
Back to foo
</p>
</div><!-- /content -->
<div data-role="footer">
<h4>
Page Footer
</h4>
</div><!-- /footer -->
Related
I have a simple page with a select menu (long dialog), an href dialog call and a tabbed content.
When I select an option the page came back and the header goes into a loop showing a new row for each autorefresh, while the page shows the tabs don't tabbed.
I use the same header on various pages but I get the problem only with this tabbed page.
Any tips?
<div data-role="page" > <!-- start header -->
<div data-role="header" data-theme="b" data-position="fixed">
Menu
Help
<h1 style="margin:0;padding:0">
<form action="" name="selectloc" method="post" data-ajax="false">
<input type="hidden" name="setssid" value="1">
<select name="formname" data-mini="true" id = "selectlocation" data-native-menu="false" data-force-dialog="true" >
<option value="n1" >label1</option>
<option value="n20" >label20</option>
</select>
</form>
<script>$('select').change(function() {
$(this).parents('form').submit();
});</script>
</h1>
</div>
<!-- /header -->
<div data-role="content" id="container" data-content-theme="d" >
label
</div>
<div id="tabs" data-role="tabs" style="max-width:600px;margin:auto;" >
<div data-role="navbar">
<ul>
<li>Weekly</li>
<li>Montly</li>
<li>Yearly</li>
</ul>
</div>
<div class="ui-body-a ui-content" id="weekly" > ...... </div>
<div class="ui-body-a ui-content" id="montly" > ...... </div>
<div class="ui-body-a ui-content" id="yearly"> ...... </div>
</div><!-- //end tabs -->
<!--- start footer -->
<div data-role="footer" data-position="fixed" data-theme="b"> .... </div>
<!-- /footer -->
<!-- panels-->
<div data-role="panel" id="nav-panelmenusx" data-display="overlay"> .... </div>
<div data-role="panel" id="nav-panelinfodx" data-position="right" data-display="overlay">...</div>
</div> <!-- // end page -->
</body>
</html>
This code is not producing a Previous button:
<div data-role="page" data-add-back-btn="true" data-back-btn-text="Previous">
<div data-role="header">
<h1>My Header</h1>
</div>
</div>
Actually to get the data-add-back-btn="true" work in latest version of jQuery Mobile 1.4, it should be at the header of the second page.
<div data-role="page" id="2ndPage">
<div data-role="header" data-add-back-btn="true" data-back-btn-text="Previous!">
<h1>HEADER</h1>
</div>
<div data-role="content">
hi
</div>
<div data-role="footer">
<p>FOOTER</p>
</div>
</div>
jQuery Mobile >= 1.4: https://stackoverflow.com/a/20065246/1771795
Adding data-add-btn-back to single page won't generate a button as there is no page before it in DOM nor in navigation history.
If you make two pages, it will appear on the next page.
<!-- page -->
<div data-role="page">
<div data-role="header">
<h1>My Header</h1>
</div>
<a href='#p1'>page 2</a>
</div>
<!-- another page -->
<div data-role="page" data-add-back-btn="true" data-back-btn-text="Previous" id='p1'>
<div data-role="header">
<h1>My Header</h1>
</div>
</div>
Demo: http://jsfiddle.net/uJz3E/1/
I'm trying to implement navbar "persistent toolbars" so that I need to define the navigation bar once.
ref: http://jquerymobile.com/demos/1.2.0/docs/toolbars/footer-persist-a.html
(you need to define data-id="the same" on each page)
First I put straight into my development, did no work and as I see it does not seem to work with simple cases either, I tried all kind of combinations.
What can be wrong width the following code ?
Navivagtion leads to the second page but not toolbar there.
CODE:
<body>
<div data-role="page" id="page" data-id="stHedaer>
<div data-role="header">
<h1>Page One</h1>
<div data-role="navbar" data-position="fixed">
<ul>
<li>page2</li>
<li>page3</li>
</ul>
</div>
</div>
<div data-role="content"> Page one </div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<div data-role="page" id="p2" data-id="stHedaer">
<div data-role="header" >
<h1>Page Two</h1>
</div>
<div data-role="content"> Content </div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<div data-role="page" id="p3" data-id="stHedaer" >
<div data-role="header">
<h1>Page Three</h1>
</div>
<div data-role="content"> Content </div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
</body>
jQM documentation must be read carefully. If you want navbar on every page you need to put it on every page. With:
...data-position="fixed" data-id="footer"...
in header and footer a like.
Here's a working example: http://jsfiddle.net/Gajotres/Beq4H/
<!DOCTYPE html>
<html>
<head>
<title>Share QR</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="home">
<div data-role="header" data-theme="b" data-position="fixed" data-id="footer">
Home
<h1>Share QR</h1>
</div>
<div data-role="content">
<p>Hello world!</p>
</div>
<div data-role="footer" data-theme="b" data-position="fixed" data-id="footer">
<div data-role="navbar">
<ul>
<li>page2</li>
<li>page3</li>
</ul>
</div>
</div>
</div>
<div data-role="page" id="about">
<div data-role="header" data-theme="b" data-position="fixed" data-id="footer">
Home
<h1>About</h1>
Back
</div>
<div data-role="content">
<p>Share your favorite URLs with other mobile phone users through QR codes.</p>
</div>
<div data-role="footer" data-theme="b" data-position="fixed" data-id="footer">
<div data-role="navbar">
<ul>
<li>page2</li>
<li>page3</li>
</ul>
</div>
</div>
</div>
</body>
</html>
<div data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="false">
<h3>Section 1</h3>
<p>I'm the collapsible set content for section 1.</p>
</div>
<div data-role="collapsible">
<h3>Section 2</h3>
<p>I'm the collapsible set content for section 2.</p>
</div>
<div> <!--I tried this but this only makes simple heading without any background style used for other collapsible section headings-->
<h3>Read only Section 3</h3>
</div>
</div>
using the above pattern I want to make some divs within the collabsile-set with heading only and I want to make them non-collapsible because of some requirements. If anybody know anything regarding this, please let me know
The collapse/expand of content is being handled in the click handler of the collapsible heading.So by unbinding the click event you can keep accordion always expanded.
$(".ui-collapsible-heading").unbind("click");
A demo here - http://jsfiddle.net/8dLw4/
Edit
Edited fiddle for keeping some in expanded state always- http://jsfiddle.net/8dLw4/2/
An attribute data-allow-collapse is added.For sections you want to allow collapse,set it as true.For other sections false.
Here is the complete source code:
<!DOCTYPE html>
<html>
<head>
<title>jQuery Mobile Sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script>
$("#page").live('pageinit', function(event) {
$(".ui-collapsible[data-allow-collapse=false]").unbind("expand collapse");
});
</script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header">
<h1>Page Title</h1>
</div><!-- /header -->
<div data-role="content">
<div data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="false" data-allow-collapse="false">
<h3>Section 1-Not allowed</h3>
<p>
I'm the collapsible set content for section B.
</p>
</div>
<div data-role="collapsible" data-collapsed="false" data-allow-collapse="true">
<h3>Section 2-Allowed</h3>
<p>
I'm the collapsible set content for section B.
</p>
</div>
<div data-role="collapsible" data-collapsed="false" data-allow-collapse="true">
<h3>Section 3-Allowed</h3>
<p>
I'm the collapsible set content for section B.
</p>
</div>
<div data-role="collapsible" data-collapsed="false" data-allow-collapse="false">
<h3>Section 4-Not allowed</h3>
<p>
I'm the collapsible set content for section B.
</p>
</div>
</div>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
Or you can use this code until section-box role is available:
<div class="ui-collapsible ui-body-c">
<h3 class="ui-collapsible-heading">
<span style="margin:0; cursor:auto;" class="ui-btn ui-corner-top ui-btn-up-a">
<span class="ui-corner-top ui-corner-bottom" style="display:block; padding: .6em 5px">Title
</span>
</span>
</h3>
<div class="ui-collapsible-content ui-body-c ui-corner-bottom">
<div>Content
</div>
</div>
</div>
You can do this:
$(".ui-collapsible").on("collapsiblecreate", function( event, ui ) {
$(this).unbind();
});
I am trying to add a 2 selection list view to the page2 footer below. I have the footer position fixed and the list view and links work just fine. My problem is I can't find a way to size the list view to stretch the screen width other than by adding text. The list view "buttons" in the footer are small and I want to control their width. Thanks
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jQuery Mobile Web App</title>
<link href="jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-1.5.min.js" type="text/javascript"></script>
<script src="jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
<script src="/phonegap.js" type="text/javascript"></script>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header">
<h1>Page One</h1>
</div>
<div data-role="content">
<ul data-role="listview">
<li>Page Two</li>
<li>Page Three</li>
<li>Page Four</li>
</ul>
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<div data-role="page" id="page2">
<div data-role="header">
<h1>Page Two</h1>
</div>
<div data-role="content">
Content
</div>
<div data-role="footer" align="center" data-position="fixed" data-theme="c">
<ul data-role="listview" data-theme="b" data-inset="true">
<li>Page One </li><br>
<li>Page 3</li>
</ul>
</div>
</div>
<div data-role="page" id="page3">
<div data-role="header">
<h1>Page Three</h1>
</div>
<div data-role="content">
Content
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
<div data-role="page" id="page4">
<div data-role="header">
<h1>Page Four</h1>
</div>
<div data-role="content">
Content
</div>
<div data-role="footer">
<h4>Page Footer</h4>
</div>
</div>
</body>
</html>
I ended up adding a navbar which did what I needed.