Need to drag and drop an item from left panel to right one - drag-and-drop

I am new to Angular Material drag and drop feature, so kindly bear with me.
I have list of items on left panel. I need to drag an item and drop it on the right panel.
I don't need sorting in left panel list, only dragging and dropping it on right side. And when I drop the item, I need some change event to occur when that material is dropped.
I was able to use cdkDrag on left panel but don't know how to drop the item. I tried to use cdkDrop, but in vain.
Here is my sample code: https://stackblitz.com/edit/angular-cevn3d
Thanks.

Here is a possible solution made from the example given by Angular Material:
<div class="example-container">
<h2>To do</h2>
<div
cdkDropList
#todoList="cdkDropList"
[cdkDropListData]="todo"
[cdkDropListConnectedTo]="[doneList]"
class="example-list">
<div class="example-box" *ngFor="let item of todo" cdkDrag>{{item}}</div>
</div>
</div>
<div class="example-container">
<h2>Done</h2>
<div
cdkDropList
#doneList="cdkDropList"
[cdkDropListData]="done"
class="example-list"
(cdkDropListDropped)="drop($event)">
<div class="example-box" *ngFor="let item of done" cdkDrag>{{item}}</div>
</div>
</div>
I removed (cdkDropListDropped)="drop($event)" and [cdkDropListConnectedTo]="[todoList]" ​​to not drop from right to left.
DEMO: Stackblitz

Related

Checkbox inside ion-slides with loop enabled

I have a page which contains ion-slides with loop enabled. Each slide is generated with *ngFor and each one contains a checkbox. The problem I am facing is that the checkbox is not getting checked on first and last slides. I have found that its because there are duplicate slides for the first slide and last slide so clicking on the checkbox is not triggering it since there are duplicates for the same. I have tried giving Id to checkbox to make it unique but since the slides are generated dynamically whatever change I give is also getting replicated. Is there any workaround for this? Any help is much appreciated.
Thank you
Here is my code
HTML part
<ion-slides pager='true' loop="true">
<ion-slide *ngFor="let slide of demoData">
<ion-card>
<ion-card-header>{{slide}}</ion-card-header>
<ion-card-content>
<ion-checkbox></ion-checkbox>
</ion-card-content>
</ion-card>
</ion-slide>
</ion-slides>
Ts Part
demoData = ['1', '2', '3'];

twitter bootstrap modal in navbar opens behind mask

I'm using the form navbar-search. I want to have an "advanced search" modal that opens from a link within the navbar.
If I put the modal div within my tag in the navbar, when the modal opens it is behind the darkened area that is normally outside of the modal window. Clicking anywhere closes the modal and the darkened mask.
I can fix this by moving the modal div outside of the navbar (and, thus, outside of my form) but then it breaks my form functionality. The advanced search modal is supposed to function as an extension of the form field directly in the navbar but if I use two different forms to fix the modal problem, the forms don't work together any longer. Does that make sense?
If I enclose the entire nav bar plus my modal (which is outside the navbar) in a tag, it works but screws up some of the navbar formatting so I'm thinking this is not a very clean solution.
So, I either need to a way to fix the modal display issue or a way to make my form situation work properly (as in, linking two forms together without having a ton of duplicate markup for hidden fields and the like).
Thanks for any ideas!
Matt
Here is what I have now (which I've gone ahead and just adjusted css afterward to make things line up). I don't think it is semantically correct according to how bootstrap's navbar is supposed to be used, but my form is working correctly and that is a big deal to me. :)
<form>
<navbar></navbar>
<modal></modal>
</form>
I am a little unsure what you are asking, but this is a stab at what I think you are asking. The modal does not actually need to put the code for the modal in the form itself. The only thing you need in the navbar is the link and trigger activating the modal.
<form>
<div class="navbar">
<div class="navbar-inner">
<ul class="nav">
<li>Advanced Search</li>
</ul>
</div>
</div>
</form>
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Advanced Search</h3>
</div>
<div class="modal-body">
<p>Put your search fields here. </p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Search</button>
</div>
</div>
See working link.
http://jsbin.com/ifaqaj/1/edit

A GridView inside a Wizard in wicket fails to render error feedback messages

I have a custom Wizard, defined as follows:
<wicket:panel>
<div>
<form wicket:id="form" class="wizard">
<span class="wizardoverview" wicket:id="overview"/>
<div class="wizardheader" wicket:id="header"/>
<div wicket:id="view" class="wizardpage"/>
<span wicket:id="feedback"/>
<div class="buttons">
<span wicket:id="buttons"/>
</div>
</form>
</div>
</wicket:panel>
The wizardpage is in this case a Panel with its own form.
This form contains a new Panel, which in turn contains a GridView.
The GridView contains a set of Panels, which each contain a FormComponentFeedbackBorder, which in turn contains input TextFields.
Phew!
So we have this:
Wizard->WizardpagePanel->Form->GridContainingPanel->GridView->Panel[]->FormComponentFeedbackBorder->TextField
When TextField fails validation, no feedback is rendered at all.
If I add a FeedbackPanel to the GridContainingPanel the error messages are rendered, but FormComponentFeedbackBorder renders nothing.
Any pointers as to what can be wrong?
I had a similar problem with a ListView instead of GridView, but that problem was resolved when I set listView.setReuseItems(true);
Is there a similar setting for GridView, or is there a different solution to this problem?
That was it:
gridView.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
solved the problem.
Thanks, rotsch.

JQTouch question, adding buttons in the footer

I am trying to add 3 buttons in a div which has "info" class as shown
below( this is basically footer section). Code is shown below
<div class='info'>
<a class="button" href="#">Full Site</a>
<a class="button" href="#">Feedback</a>
<a class="button" href="#">Contact Us</a>
</div>
I want to show these 3 buttons at left, center and right.
(Above code just shows "Contact Us" button on top of the page). How do
I fix this?
I'm no jQTouch/CSS expert, but I believe this is related to the button class you're using for each link.
The button class absolutely positions items at the top, which is why your buttons aren't appearing in the footer. Additionally all three buttons are being positioned in the exact same spot, but you're only seeing the last/latest one - the Contact Us button.
The CSS file that contains this class is located within each of the theme folders (apple, default or jqt). Each one has a theme.css file.
Again, not being a strong CSS person... my advice would be to create a new class. Keep the attributes you like from the existing button class, but maybe remove the position aspects of it. This will largely depend on what kind of look and feel you want to keep/maintain.
Additionally, it may be easier for you to place your buttons within an unordered list. This gives you some more flexibility when trying to position things through CSS.
<div class='info'>
<ul class="newULClass">
<li><a class="newButtonClass" href="#">Full Site</a></li>
<li><a class="newButtonClass" href="#">Feedback</a></li>
<li><a class="newButtonClass" href="#">Contact Us</a></li>
</ul>
</div>

jQtouch toggal checkbox change default position to On

I am using jQtouch for my iPhone application,
I need to check box filed, in jQtouch we have the code below like this.
<ul>
<li>
Toggle The <span class="toggle"><input type="checkbox"/></span>
</li>
</ul>
By using this code we can display the
On-Off image, in the it will be by default off position.
But I need the 'On' position by default.
can you some one help me out for this.
The simplest solution is to add "checked" to the <input> tag:
Toggle The <span class="toggle"><input type="checkbox" checked/></span>
IF you want to handle programmaticaly:
$('toggle input[type="checkbox"]').attr('checked', true)
If you put that in your .Ready() (or page loaded function) the checkbox will be checked by default.
I would recommend that you give the Checkbox an id so that you can specify exactly which you want to change:
<ul>
<li>
Toggle The <span class="toggle"><input id="myCheckbox" type="checkbox"/></span>
</li>
</ul>
Then use:
$('#myCheckbox').attr('checked', true)