react-bootstrap grid layout columns rendering as rows - react-bootstrap

I have the following render method and I am expecting to have two columns in my layout but am getting two rows instead:
render() {
return (
<div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css" />
<Grid>
<Row>
<Col>
My Header
</Col>
</Row>
<Row>
<Col>test</Col><Col>test</Col>
</Row>
</Grid>
</div>
);
I'd expect things to render like this:
My header
Col One Col Two
but instead things are rendered like this:
My header
Col One
Col Two
What am I missing?

You are likely not importing the bootstrap css. Check out this issue on Github or the documentation on this page for React Bootstrap.
From React Bootstrap Website:
Because React-Bootstrap doesn't depend on a very precise version of Bootstrap, we don't ship with any included css. However, some stylesheet is required to use these components. How and which bootstrap styles you include is up to you, but the simplest way is to include the latest styles from the CDN.
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous"
/>

I had the same problem. I resolved it by adding xs- specifications. Not entirely sure why it fixed it, so can't really elaborate on that. Maybe someone more experienced can.
To clarify, here's a working example of your code:
render() {
return (
<div>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap-theme.min.css" />
<Grid>
<Row>
<Col>
My Header
</Col>
</Row>
<Row>
<Col xs = "5" >test</Col><Col xs = "5" >test</Col>
</Row>
</Grid>
</div>
);

TRY this code
<div class="container">
<div class="row">
<div class="col">
1 of 2
</div>
<div class="col">
2 of 2
</div>
</div>
<div class="row">
<div class="col">
1 of 3
</div>
<div class="col">
2 of 3
</div>
<div class="col">
3 of 3
</div>
</div>
</div>
For more info :
https://getbootstrap.com/docs/4.0/layout/grid/

Related

CSS doesn't effect in blade

I'm encountering a problem today: I just created a new blade view that displays my HTML, but my CSS doesn't work! I tried several ways like putting it directly on the page, putting it outside my layout, nothing to do... it works on all my other pages that are exactly the same place on my workspace.
Here is my blade file:
#extends('layouts.default')
#section('content')
<section class="blog-outer-area mt-5">
<div class="content-area">
<div class="blog-area-sec">
<!-- Start: Blog Sec -->
<div class="blog-sec">
<div class="container">
<!-- Start:Blog Area -->
<div class="blog-inner-area row">
<!-- Start:Blog Left Content-->
<div class="col-lg-8 left">
<div class="item-box">
<div class=" img-holder">
<img src="template/img/home-blog-1.jpg" alt="">
</div>
<div class=" img-holder">
<img src="template/img/home-blog-1.jpg" alt="">
</div>
<div class="info-text-holder">
<h4>{{ $article->titre }}</h4>
<span>{{ $article->created_at->format('d/m/Y') }}</span>
<p>{{ $article->description }}</p>
<ul class="social-icon-simple">
<li><i class="fa fa-facebook"></i></li>
</ul>
</div>
</div>
</div>
<!-- End:Blog Left Content-->
<!-- Start:Blog Right Content-->
<div class="col-lg-4 ">
<div class="right">
<input type="text" name="search" class="search-btn" placeholder="Search Here">
<!-- Start:Recent Posts-->
<h5>Recent posts</h5>
<ul class="recent-post">
<!-- Start:Post 1-->
<li>
<div class="row">
<div class="col-lg-5">
<img src="template/img/blog-4.jpg" alt="">
</div>
<div class="col-lg-7">
<div class="text">
<p>Stetina savours Tour de France return</p>
</div>
</div>
</div>
</li>
<!-- End:Post 1-->
<!-- Start:Post 2-->
<li>
<div class="row">
<div class="col-lg-5">
<img src="template/img/blog-5.jpg" alt="">
</div>
<div class="col-lg-7">
<div class="text">
<p>Top Fitness Gear to Help You Workout</p>
</div>
</div>
</div>
</li>
<!-- End:Post 2-->
<!-- Start:Post 3-->
<li>
<div class="row">
<div class="col-lg-5">
<img src="template/img/blog-6.jpg" alt="">
</div>
<div class="col-lg-7">
<div class="text">
<p>The Southern Ocean is the 'newest' named ocean</p>
</div>
</div>
</div>
</li>
<!-- End:Post 3-->
</ul>
<!-- End:Recent Posts-->
</div>
</div>
<!-- End:Blog Right Content-->
</div>
<!-- End:Blog Area -->
</div>
</div>
<!-- End: Blog Sec -->
</div>
</div>
</section>
#endsection
My Layout integrations:
<link type="text/css" rel="stylesheet" href="template/css/bootstrap.min.css"><!-- Bootstrap -->
<link type="text/css" rel="stylesheet" href="template/font-awesome/css/font-awesome.min.css"><!-- font-awesome -->
<link type="text/css" rel="stylesheet" href="template/css/animate.min.css"><!-- Animation -->
<link type="text/css" rel="stylesheet" href="template/css/flexslider.css"><!-- FlexSlider CSS -->
<link type="text/css" rel="stylesheet" href="template/css/style.css"><!-- Light Theme Core CSS -->
<!-- Google Fonts here -->
<link href="template/css/fonts/poppins.css" rel='stylesheet' type='text/css'>
<link href="template/css/fonts/open-sans.css" type='text/css'>
<link href="template/css/fonts/lato.css" rel='stylesheet' type='text/css'>
My workspace looks like this:
Try this
<link type="text/css" rel="stylesheet" href="/template/css/bootstrap.min.css"><!-- Bootstrap -->
<link type="text/css" rel="stylesheet" href="/template/font-awesome/css/font-awesome.min.css"><!-- font-awesome -->
<link type="text/css" rel="stylesheet" href="/template/css/animate.min.css"><!-- Animation -->
<link type="text/css" rel="stylesheet" href="/template/css/flexslider.css"><!-- FlexSlider CSS -->
<link type="text/css" rel="stylesheet" href="/template/css/style.css"><!-- Light Theme Core CSS -->
<!-- Google Fonts here -->
<link href="/template/css/fonts/poppins.css" rel='stylesheet' type='text/css'>
<link href="/template/css/fonts/open-sans.css" type='text/css'>
<link href="/template/css/fonts/lato.css" rel='stylesheet' type='text/css'>

Create pdf having each page background in different color using DOMPDF

I am generating reports using DOMPDF in codeigniter. This pdf have 10 pages in which 3 pages have yellow background (Page #2, #5 and #8 and entire page bgcolor needs to be yellow without margin or spacing) rest pages background color is white.
Also, i am using DOMPDF's html5 parser by setting "DOMPDF_ENABLE_HTML5PARSER" config as true. This is because my report html's contains html5 tags like footer.
I googled this and found one solution as to put each page in separate "body" tag but generated output have all pages in yellow background.
Below is my html template:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Report</title>
<link rel="stylesheet" href="css/reports/styles.css" />
</head>
<!-- Page #1 -->
<body>
<div>
<div class="wrapper">
<h1>Heading</h1>
<ul class="index">
<li>2. report 1</li>
<li>5. report 2</li>
<li>8. report 3</li>
</ul>
</div>
</div>
</body>
<!-- Page #2 -->
<body style="background-color: #f2ab02">
<div>
<div class="wrapper">
<h1>Report 1: Analysis & Results</h1>
<img src="/img/reports/human-face.png" class="imglogo" />
</div>
</div>
</body>
<!-- Page #3 -->
<body>
<div>
<h1>Report 1: (1/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">3</div>
</footer>
</div>
</body>
<!-- Page #4 -->
<body>
<div>
<h1>Report 1: (2/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">4</div>
</footer>
</div>
</body>
<!-- Page #5 -->
<body style="background-color: #f2ab02">
<div>
<div class="wrapper">
<h1>Report 2: Analysis & Results</h1>
<img src="/img/reports/human-face.png" class="imglogo" />
</div>
</div>
</body>
<!-- Page #6 -->
<body>
<div>
<h1>Report 2: (1/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">6</div>
</footer>
</div>
</body>
<!-- Page #7 -->
<body>
<div>
<h1>Report 2: (2/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">7</div>
</footer>
</div>
</body>
<!-- Page #8 -->
<body style="background-color: #f2ab02">
<div>
<h1>Report 3: Analysis & Results</h1>
<img src="/img/reports/human-face.png" class="imglogo" />
</div>
</body>
<!-- Page #9 -->
<body>
<div>
<h1>Report 3: (1/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">9</div>
</footer>
</div>
</body>
<!-- Page #10 -->
<body>
<div>
<h1>Report 3: (2/2)</h1>
<table>...</table>
<footer>
<img src="/img/reports/logo.png" class="footer-logo" />
<div class="page_number">10</div>
</footer>
</div>
</body>
</html>
Any help will be appreciated.
I can't say that I would recommend this method, but it might work if you disable the HTML5 parser. The main use of the HTML5 parser in dompdf is to correct syntactical errors. Multiple BODY elements are not permitted and so after passing through the HTML5 parser the multiple body elements will be merged into a single element.

Jquery mobile href link dont load new page

i'm a web devoper from Italy...I have a problem with loading with href
example:
i have one.html with this code
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>dkrMobile</title>
<!--caricamento librerie-->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery.mobile-1.3.1.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css">
</head>
<body>
<!-- LOGIN -->
<div data-role="page" id="loginPage">
<div data-role="content">
<div style=" text-align:center">
<img style="width: 70%;" src="http://www.laboncloud.it/dkrmobile/css/images/logdkr.png">
</div>
<form action="#pageFile">
<div data-role="fieldcontain">
<label for="userNameLogin">
Username
</label>
<input name="" id="userNameLogin" placeholder="" value="" type="text">
</div>
<div data-role="fieldcontain">
<label for="passwordLogin">
Password
</label>
<input name="" id="passwordLogin" placeholder="" value="" type="password">
</div>
<a data-role="button" data-theme="a" data-transition="fade" href="two.html" data-prefetch="trues">
Login
</a>
</form>
</div>
</div>
</body>
</html>
and the two.html with this code:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>dkrMobile</title>
<!--caricamento librerie-->
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/jquery.mobile-1.3.1.min.js"></script>
<link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css">
<link rel="stylesheet" href="css/jqm-icon-pack-fa.css">
<script type="text/javascript" src="js/tolito-1.0.5.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/tolito-1.0.5.min.css" />
<!--css userinterface-->
<link rel="stylesheet" href="css/ui.css" />
</head>
<body>
<div data-role="page" id="loadingPage">
<div data-role="content">
<h1>caricamento di tutti i contenuti in corso</h1>
<a data-role="button" data-theme="a" data-transition="fade" href="#pageFile">skip</a>
</div>
</div>
<div data-role="page" id="pageFile">
<div data-role="content">
<h1>dueeee</h1>
</div>
</div>
<!-- FILE-->
</body>
</html>
now if tap on login - the two.html will no be loaded.
want a demo?
here the demo
if I click on skip in two.html dont show nothing (if I refresh the page it start work).
the only way is data-ajax="false" ? why?
This is not an error. To understand this problem you must understand how jQuery Mobile works.
Multi HTML template can't be mixed with multi page template. For example when working with several HTML pages, only first one can have more then one page. When jQuery Mobile loads other HTML files it will strip HEAD (we dont need it because first HTML HEAD content is already loaded into the DOM) and it will load ONLY first page it can find in a file, every other page will be discarded.
data-prefetch will not help you here. Also you are initializing it incorrectly, data-prefetch attribute don't have a value, it is just data-prefetch, example:
<a data-role="button" data-theme="a" data-transition="fade" href="two.html" data-prefetch>Login</a>
If you want to find out more how jQuery Mobile handles multiple HTML and multiple page templates or what are they take a look at this ARTICLE or THIS one. To be transparent they are my personal blog articles. Everything you need to know can be found there.
Basically solution to your problem would be to have all pages inside a single HTML file, or you should brake two.html into two separate HTML files. you decide what is a best solution for you.

Rendering pages in mvc3 from xml

I want some static pages of application to be rendered from XML i.e. i am planning to have a base page and xml containing structure of the page and xslt which will be transforming this xml to html and at runtime i will be rendering this html to my view and displaying this view
Is there any way/ example for doing the same. Please help
Here is the sample xml
<!DOCTYPE html>
<html>
<head>
<title>Create</title>
<script src="/Scripts/jquery-1.5.1.min.js" type="text/javascript" />
<link href="/Content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
<script src="/Scripts/jquery-ui.js" type="text/javascript" />
<script src="/Scripts/jquery.validate.min.js" type="text/javascript" />
<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript" />
<script src="/Scripts/jquery.unobtrusive-ajax.js" type="text/javascript" />
</head>
<body>
<div id="menucontainer">
<ul id="menu">
<li>
Rutu
</li>
<li>
Employee
</li>
</ul>
</div>
<h2>Create</h2>
<script src="/Scripts/jquery.validate.min.js" type="text/javascript" />
<script src="/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript" />
<form action="/Employee/Create" method="post">
<fieldset>
<legend>EmployeeDetailsModel</legend>
<div class="editor-label">
<label for="EmpName">EmpName</label>
</div>
<div class="editor-field">
<input class="text-box single-line" id="EmpName" name="EmpName" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="EmpName" data-valmsg-replace="true" />
</div>
<div class="editor-label">
<label for="DeptId">DeptId</label>
</div>
<div class="editor-field">
<input class="text-box single-line" data-val="true" data-val-number="The field DeptId must be a number." data-val-required="The DeptId field is required." id="DeptId" name="DeptId" type="text" value="" />
<span class="field-validation-valid" data-valmsg-for="DeptId" data-valmsg- replace="true" />
</div>
<p>
<input type="submit" value="Create" />
</p>
</fieldset>
</form>
<div>
Back to List
</div>
There is a good blog post here that describes how to create an HTML Helper to render the XSLT in a view. You just call the helper class from your view passing in the path to the XSLT and the XML. I have modified this helper so that you can also pass the XSLT and XML as strings to achieve the same results.
MvcContrib project provides an XSLT based view engine http://mvccontrib.codeplex.com/releases - I would suggest to check it out.

jQuery-Mobile not running in Windows Phone 7?

I doing one simple task in jQuery alpha 4. It run in browser but when I run in WP7 emulator, it shows only white screen? can any one suggest me how to run in WP7?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Alpha 4 test</title>
<!-- alpha 4 for jQuery mobile -->
<link rel="stylesheet" href="script/jquery.mobile-1.0a4.min.css" />
<script type="text/javascript" src="script/jquery-1.5.min.js"></script>
<script type="text/javascript" src="script/jquery.mobile-1.0a4.min.js"></script>
<script type="text/javascript">
function callpage2()
{
$.mobile.changePage("#detailpage","slide",false,false);
}
</script>
</head>
<body id="callweb">
<!-- /Page Starts -->
<div data-role="page" id="searchpage">
<!-- /header Starts-->
<div data-role="header" data-backbtn="false">
<center><font size="2"><h3>Saxo Tech</h3></font></center>
</div>
<!-- /header Ends -->
<!--Content Begins-->
<center>
<div data-role="content" id="content">
First page
Using ID
<button onclick="callpage2()"> Using button (mobile changepage)</button>
<ul data-role="listview" data-inset="true" data-theme="e">
<li><img src="script/images/11.jpg" class="ui-li-thumb" /> <a style="margin-left:1em;">one</a></li>
<li> <img src="script/images/globe.jpg" class="ui-li-thumb" /><a style="margin-left:1em;">two</a></li>
</ul>
</div>
</center>
<!--Content Ends-->
</div>
<!-- Page End-->
<!-- Detail Page Starts -->
<div data-role="page" id="detailpage">
<!-- /header Starts-->
<div data-role="header">
<center><font size="2"><h3>Saxo Tech</h3></font></center>
Back
</div>
<!-- /header Ends -->
<!--Content Begins-->
<center>
<div data-role="content" id="content">
second page
</div>
</center>
<!--Content Ends-->
</div>
<!--Detail Page End-->
</body>
</html>
The debug capabilities on the mobile browser are not very advanced.
The best way to debug this is to try using the desktop browser instead. Does this example run on IE7 (or IE9 running in compatible mode)? Get it working there first, then move it across to the mobile UI.
I would suggest to used the CDN instead your local files for invoking jQuery and jQMobile just to start.
change this
<link rel="stylesheet" href="script/jquery.mobile-1.0a4.min.css" />
<script type="text/javascript" src="script/jquery-1.5.min.js"></script>
<script type="text/javascript" src="script/jquery.mobile-1.0a4.min.js"></script>
into this
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4/jquery.mobile-1.0a4.min.js"></script>
I have run into this same issue before.
For me it was an issue with my html syntax and I think is could be a similar issue here (It seems JQM under WP7 is very picky about its HTML)
I'd start with the centre tags around the content divs, either get rid of them or move them inside. Maybe even the font tags and use CSS classes.

Resources