how to make table as show in image? - css

I am trying to make table or grid view in ionic framework.I am able to make that table but It is not looking same what I am required please check my table view in image .
here is my code .Actually I have also header "Invoice#" and "account Name" they should become background gray .Actually I saw if we take two column in row it take 50% 50% width of window .But when there is 3 column column take 33.33 % width But in my case they are not able to take where I am doing wrong Actually I am generating column dynamically Now it is two but may be later five .I need they will take equal space of total width .is this possible to add "+" in last column ?
here is code
<div class="row">
<div ng-repeat="d in data | filter:{checked: true}">
<div class="col">{{d.label}}</div>
<div class="row" ng-repeat="column in displayData">
<div class="col" ng-repeat="field in column.columns" ng-show="d.fieldNameOrPath==field.fieldNameOrPath">{{field.value}}</div>
</div>
</div>
</div>
http://plnkr.co/edit/X0PQov1UA2yEbx8qaOFl?p=preview

Here's a working version of your Plunker. To see the columns added and removed, click the gear icon in the header right.
Plunker
To get your grid to layout properly, you can't nest your repeats. That means you have to slightly change your ng-show to observe the checked values on the data model directly.
In it's most basic form, it would look like this:
<div class="row">
<div class="col" ng-repeat="d in data | filter:{checked: true}">{{d.label}}</div>
</div>
<div class="row" ng-repeat="column in displayData | filter: query">
<div class="col" ng-repeat="field in column.columns" ng-show="data[$index].checked && data[$index].fieldNameOrPath===field.fieldNameOrPath">{{field.value}}</div>
</div>
You'll notice that Ionic automatically handles making the grid full width and when properly laid out, it will automatically evenly space your columns. That's because it uses flexbox. That also allows you to tell specific columns how much space they should use. The remaining columns will naturally even distribute to take up the rest of the space. In the demo, I added a column for the gear and the details buttons and gave them col-10 class. This will force these columns to take up 10% of the screen width. For more on how the grid works in Ionic read the docs here.
I also noted that you seemed to have lots of functions where you're trying to do things like manage how the checked values are updated. Stop doing that. That's the beauty of AngularJS and the ng-model directive. If the property doesn't exist on the scope, Angular just creates it for you, and if it does exist, it just updates it. For example, notice how simply I made your search work by setting the ng-model value and passing that to the filter. I didn't have to create a $scope.query because ngModel does that for me. Similarly, I removed all of the functions and references to the 'checked' values from your controller and everything just works because ngModel automatically adds the checked property to the data model.

Related

Labels and textbox sizing and aligning problems in Bootstrap 4

I am working on a Bootstrap based form and struggling to get things to position properly.
I am trying to create a form consisting of labels/prompts and textboxes. The problems that I have with my code are
the label column (col-3) is too wide and reducing it to col-2 is too narrow. But I would like to make it narrower than what it is now.
the textboxes in the textbox column (col-4) are the same length but it does not matter what their class is, they don't get any wider. I would like them all wider.
not sure if I need col-5
I want the controls vertically middle within the row. They look like they are aligned to the top.
I have tried different classes and controls and cannot get something to work. This code will be put in a ASP.Net MVC project which is what the #Html.TextBoxFor is for, but I don't think this is an issue.
<div class="container">
<div class="row" style="height:38px">
<div class="col-3">Label 1:</div>
<div class="col-4">#Html.TextBoxFor(m => m.Textbox1)</div>
<div class="col-5"></div>
</div>
<div class="row" style="height:38px">
<div class="col-3">Label 2:</div>
<div class="col-4">#Html.TextBoxFor(m => m.Textbox2)</div>
<div class="col-5"></div>
</div>
</div>
Bootstrap 4 actually has column management here: https://getbootstrap.com/docs/4.3/layout/grid/
Specifically, col-sm-,col-md-,col-lg tags should assist you in choosing one thats the proper size

Column and grid system in Bootstrap 4

I'm new in Angular and Bootsrap 4, and I'm having trouble setting up the layout for a dashboard I'm currently working on. I have a series of cards that need to be arranged in a particular way, as follows:
I have a row, in which I have put a col-12 div, and inside I have placed all the cards (1,2 and 3 are static content, the others are loaded with a ngFor, from a list that comes from the database).
The problem with this is that since card 1's has double height relative to all the others, cols for 2 and 3 are the same height as the col for card one. The result is as follows:
Is there a way to fix this using my approach, say, having the extra empty space in the colums for the cards 2 and 3 taken away, and place the other cards in there? Or should I use a completely different approach?
edit: Here's the code I've used.
<div class="col-lg-12">
<div class="row">
<div class="double-card-col">
<app-tool-card-double-1></app-tool-card-double-1>
</div>
<div class="cards">
<tool-card-2></tool-card-2>
<tool-card-3></tool-card-3>
</div>
<ng-container *ngFor="let tool of tools; trackBy: trackBy">
<tool-card></tool-card>
</ng-container>
</div>

how to change semantic-ui default 16 column count to 24

I tried to put a "#columnCount: 24;" in src/site/globals/site.variables and execute "gulp build" but it turns out there is nothing changed.
Another doubt is even if this works, can I use something like "twenty wide column" for my page elements?
Directly from the Semantic UI website :
All grid systems use an arbitrary column count. Semantic's default theme assumes 16 columns. This number can be adjusted in your project by adjust the #columnCount value in site.variables.
The #columnCount variable can only go up to 16.
Since Semantic-UI was built with a 16 column default, all the other related variables and calculations are based off that. In order to go higher than 16 columns you'll have to find the appropriate places and add the necessary variables, calculations, and classes in order to make it work.
However, there are a couple of easier ways that I think you could accomplish what you're looking for.
First, rather than adding in more columns, you might be able to accomplish what you're looking for by changing the margins and paddings of the appropriate elements or possibly by using the "relaxed" or "very relaxed" classes.
But if you absolutely need that many columns, then try using nested grids.
Something like this perhaps:
<div class="ui two column grid">
<div class="column">
<div class="ui ten column grid">
</div>
</div>
<div class="column">
<div class="ui ten column grid">
</div>
</div>
</div>

AngularJS Loops and Formatting with ng-repeat for image and link text

I need to be able to arrange a list of images (4 in my case) to a row and the link text to appear below like so:
row1
image1 image2 image3 image4
linkText1 linkText2 linkText3 linkText4
row2
image5 image6....
linkText5 linkText6.....
and so for however many images are. Here whether you click on the image or on its linkText, its supposed to open a document in a new window.
Here's the html that I intend, but doesn't work the way I want. It just puts one image per row. I have tried various combinations nothing seems to work. Although if I use just the img element and use the ng-repeat on it, the images flow the way I want, 4 to a row, but that doesn't serve my purpose as I want the link text as well below each image.
<div ng-repeat="items in DocImageCollection ">
<div ng-repeat="row in items">
<img alt="{{row.linkText}}"
ng-click="$event.preventDefault();openDocument({{row}});" ng-src="{{row.imageSrc}}" imageonload />
<br />
<span ng-click="$event.preventDefault();openDocument({{row}});">
{{row.linkText}}</span>
</div>
</div>
Here
imageonload is a directive which I have created for downloading the
image source,
DocImageCollection - is the main collection; for e.g. if I have 10 images in
all, then this will be an object array of capacity = 3, where each array
element (row) is itself an array of 4 image objects
I have all the data correct, I just have issue in the templating. Any help is
greatly appreciated.
The div tag is a block level element so it'll appear on it's own line unless you change the CSS display attribute to inline-block. Specifically, you need to target the display attribute for the div that contains the img and link.
Here's an example on codepen:
http://codepen.io/gwmccull/pen/LpYLLp
you can use an indexing method with your ng-repeat.
Check this
Adapted from here
ps. Not necessarily you will use the ng-if, this only serves you in case you want to only show multiples of 4

How to properly swap columns in only two viewports using Bootstrap's PUSH and PULL classes

I've got a form tool with two lists and a set of tools between them that is laid out in three columns on larger screens like so...
<div class="row">
<div class="col-md-5">
AVAILABLE LIST (1)
</div>
<div class="col-md-2">
MOVEMENT BUTTONS (2)
</div>
<div class="col-md-5">
SELECTED LIST (3)
</div>
</div>
... as you can see, for the xs and sm viewports, the layout should switch to a full width stacked list. What I would like to do is to swap the positions of the MOVEMENT BUTTONS and SELECTED LIST columns on those smaller view ports so that the tools are the last row (1-2-3 => 1-3-2).
The problem I'm having is that when I add classes like col-xs-pull-* col-sm-pull-* to the SELECTED LIST, and col-xs-push-* col-sm-push-* to the MOVEMENT BUTTONS columns, the buttons column dissapears and the selected list is out of alignment. I've tried corresponding col-*-push/pull values of 1 (because anything should swap them when they're full width, shouldn't they?) and 12 (just in case), both have the same unintended result.
How can I apply push/pull modifier classes to the two columns in question to achieve reordered stacking on xs and sm viewports?
One important thing to realize about Twitter Bootstrap is that they take a mobile-first design mindset. This means that classes that apply to extra-small screens will apply all the way up to large screens unless you overload them.
This is also true for the push and pull classes. So what you need to do is layout the buttons the way you intend for them to be in a small screen and then push/pull them in larger screens to where you want them.
In other words, put the buttons in your HTML where you want them in small screens and use the push/pull medium classes to move them in larger screens.
Edit
I've created a Bootply demonstrating the concept of pushing and pulling. See if that makes sense.
The gist of it is this:
<div class="col-md-5">
AVAILABLE LIST (1)
</div>
<div class="col-md-5 col-md-push-2">
SELECTED LIST (3)
</div>
<div class="col-md-2 col-md-pull-5">
MOVEMENT BUTTONS (2)
</div>
A push class moves an element to the right a number of columns and the pull class moves an element to the left a number of columns. For example, if you want to switch two elements, the first of size 3 and the second of size 6, you will need to push the first 6 columns and pull the second 3 columns, effectively switching their positions.

Resources