jQuery UI Sortable “Keep Together”? - jquery-ui

I have a list of elements that work fine with jQuery UI sortable, but now I want to be able to group some adjacent siblings together. Is there a direct way of doing that, similar to the way a rich-text document has a keep-together or keep-with-next attribute on paragraphs?
For example, if I have items 123456, what’s the best way to keep 2 & 3 together, so that a) If I drag either 2 or 3, then they move together and b) It's not possible to drop something between 2 and 3?

My solution was to add a wrapper around the grouped elements with help from jQuery methods replaceWith() to remove the wrapper and wrapAll() to wrap the group. This requires some juggling if what you start with expects the individual elements to be direct children, but if you're referencing those elements by a class selector, it should go pretty easily.
I also wanted to be able to optionally lock the first and last items in place, and the solution there was to get a subset of the direct children and omit or include the first/last elements via slice().
If there's enough interest from anyone other than me, I’ll post some example code fragments.

Related

Vaadin 23 proper usage of nested layouts

Typically, when I need to present some information, I use VerticalLayout (VL) as a main container and many of nested HorizonalLayouts (HL). I may be wrong, but I feel that this is not a very effective way to organize the information. I suppose I may achieve the same without nesting of such amount of HorizonalLayouts.
For example, I need to present user info with 100 lines, each line will have 5-10 spans. Typically, with my current approach, I'll create 1 VL and 100 HL for that.
Is there a more effective way to present this information other than nesting 100 HL into VL ?
You're absolutely correct about that – the main inefficiency being that HorizontalLayouts are a bit heavier than plain html elements that would probably do the job just fine.
There are many different ways to approach this, but I'm going to assume that you're basically rendering a table where you want each element to line up in neat columns.
HTML has the <table> element for that, but unfortunately Flow does not have an API for doing <table>s easily.
The easiest way is probably to use this add-on that provides such an API: https://vaadin.com/directory/component/html-table/overview
Other ways would be to e.g. use Divs for tables, rows and cells instead. Divs can be made to render as those elements by applying the appropriate display css values table, table-row and table-cell. These can be applied via classnames or the Style API in Flow:
Div cell = new Div();
cell.getStyle().set("display", "table-cell");

Jira Structure - showing issue link type in formula column

Using the Jira Structure plugin, I have generally this type of organization.
Issue1
Issue2
Issue3
Issue4 (blocks Issue3)
Issue5
This is done using the automatic generators. Roughly, populate the list of all issue1s, the extending with relations with the last level being issues related that block their parents. So in this case, Issue4 blocks Issue3.
What I desire, is an indicator on Issue1 that highlights it has a blocking issue in it's tree. Then when I expand issue1, I see the indicator on Issue2, then Issue3 until we get to the blocking issue. I suspect this can be done with a custom formula column, but I'm unable to find a way to make it work.
I figure I can use the wiki markup like explained here to make the indicator, but how can I detect a parent has children that are blocked? I feel like it should be something be like:
IF(anyChildrenLinkType()="Blocked by", ShowIndicator(), DoNothing())

Visual studio online query items without tags

When are working with various Work Item types (user stories,Tasks, etc) we assign tags to reference the area of work. This makes it easy to filter the Backlogs items view to find any related stories.
I would like to build a query to identify Work Items where the tags have not yet been assigned.
I know this can be achieved using excel and filtering, however I specifically would like to do this using the queries. Is this possible??
Thanks in advance for any assistance.
Firstly, I have to say that it is not possible to create work item query to show work items which don't contain tags. As you see that the Operator for Tags is Contains or Does Not Contain, it is not possible to use these two operators to filter out these non-tagged work items.
Secondly, as you have more than 100 tags, it is not an effective way to use "Does Not Contain" operator to exclude all tagged work items.
So,
How about you adding a 'Null' tag to all non-tagged work items to specify that these work items don't have any tags? With this approach, you can create a work item query with Tags Contains Null to list these non-tagged work items.
If you don't want to take this approach, you need to work with excel just as you mentioned above, or take Dave's advice to work with API.

Creating new items to put in a list (like the phonebook) iPhone SDK?

Let's say I want to create an app that lets add people to a list (like the phone book). And within this app I'm able to put how many cars this person has and what color it is.
Coming from a C++ background, the logical thing to do is create a linked list with all of of this info. If I wanted to know how many blue cars my friends have, I could use an iterator to count how many blue cars there are.
Would I use the same concept in objective-c? I want to be able to have the little 'plus' sign at the top, right-hand corner of the screen so that I could keep adding people to my list. So my first issue is making this happen. I created a storyboard to make the basics happen. My follow-up issue would be to iterate through the list and count how many 'blue' cars there are.
I'm not asking for code here... I'm asking for concepts. How would you go about doing this?
Use an NSMutableArray which is kindof like a vector in c++. It's not neccessary with a linked list. If you want it twodimensional simply use a NSMutableDictionary which works like a map in c++.
yes here if you can handle global NSMutableArray with its key then it is possible here.....
now as a example if you have people name with name key and also another key with car then when you click on plus sign you add the record in your another error and at last you commit your data with final array....
hope,help it.....
:)

Multiple Expanding Nodes in Virtual TreeView possible?

I am using a TVirtualStringTree (part of the Virtual TreeView Component) in my Delphi project and I would like to create a view where 2 columns can have children that are expandable/collapsable with [+] sign.
In the picture below as sample I would like to have a [+] sign in the Server Column but also in the Image column. The idea is that the tree has several Server nodes that each have many process child's (which main colum is image) and some processes have sub-processes which are children of the processes'node.
(source: remkoweijnen.nl)
Is such a layout possible? If not with the default component I would appreciate advice on how to implement this in a descendant.
/Edit: The following screenshots are when using the method TOndrej suggests:
alt text http://www.remkoweijnen.nl/temp/TreeView2.png
alt text http://www.remkoweijnen.nl/temp/TreeView3.png
alt text http://www.remkoweijnen.nl/temp/TreeView4.png
OK, I decided to implement as per TOndrej's idea:
alt text http://www.remkoweijnen.nl/temp/TreeView5.png
You most probably don't need that. Just make yourself a clear specification of what grouping you need. The first column can be multi-purpose - showing different information on each grouping level - e.g. level 0: server, level 1: process, level 2 and higher: child process.
On each level, only columns relevant to that level need to display any information. In the above example, level 0 would only display the server name in the first column; the rest of the columns would remain empty.
You could probably implement as many plus signs as you want by custom-drawing but it would be a lot of work and I really think the result is unnecessary, unusual and easily confusing to the user.
Only one column can have the tree, the other columns act a a listview. The column with the tree is the main column.
I would not know how your grouping would work if two columns had a tree and they might "conflict". What is parent node etc etc. GUI technically this might not be the best way of giving those details; a user won't expect it to work that way.

Resources