My guess is that, under the actual video, is one table view, which has two sections.
The first section's header includes the video's title and other details and the rows are the related videos. The second section's header has the comment form and the rows are the comments.
How else could this be done? If the related videos, for example, is a distinct table view, then given that its a scroll view, wouldn't it scroll in place instead of scrolling as part of the overall screen?
Open YouTube right click> view page source. Add see the structure
Do this inside a a video page. You could inspect element also if your in chrome. To mouseover certain elements on the page to see their styling
Ctrl+shift+C will change your mouse action from element click to element selection
I think it has two sections
In first section it has title descriptions and other information in header and related videos in rows and in second section it has comments heading and comment text box in header and comments in rows
How to implement it
Create 4 cells two header cells and two rows cells
Related
I need to iterate the title content (not header) of the table to the next page, if the table spans over to the next page. Seems like the nested table was the only solution for it, as we can use "headerRows" property to iterate any content onto the next page during the table spanning over to the next page.
But after using the nested table approach, the rows of the table are just being overflowed in the same page and the rows are getting lost from the bottom of the page. I tried many combinations by applying many of the table related properties. none of them worked as expected.
Properties tried are: dontBreakRows, keepWithHeaderRows, pageBreak
Tried all sorts of combinations for both outer and inner tables, none worked as expected.
For better understanding of the problem: 30 rows - 3 sets of data (30x3) with each set having its own title to be displayed at the top of its table. As each set has 30 of rows, then the table for each set surely spans over to the next page, hence the same previous table title has to be displayed on top of the continued table (set) on the next page, and there will be a problem in either displaying the table title / handling the overflow of the table.
I have RTF template that extracts sales invoices. The item details has 3 rows per item and is working fine if the no of lines is printed in one page. If the lines crosses to next page some times the row details gets splited to the next page. What I want is if the value moves to the next page then the entire line (3 rows) should move to the next page. I have unchecked "Allow row to break across pages" but it didn't work. I also tried "Keep with next" in paragraph properties and it didn't work.
You should use a table inside a table for this purpose, or better, just put your content in the same cell with an enter between your elements. It's needs to be on a single row if you dont want it to break apart.
I have a form which has a table which may contain 0 rows or several rows.
The problem is that if there are several rows I want close the table on the first page before the content spills over to the next page. Then create another table for the rest of the rows on the next page along with a nice header and table headings. The hard part is, because characters have different widths and I can't predict what the user will type, it's hard to calculate how many characters can fit on a row and how many rows can fit on a page. Also if the user types something in some of the row data, it wraps to a 2nd row.
The printout looks bad when the row has only a few rows because there is a lot of whitespace on the bottom so I was thinking of adding in blank rows to fill it up. But again, I won't exactly know how many rows I need to fill before it spills onto the next page.
Does anyone have a solution to this?
EDIT:
Sorry about that. To be more clear on what I'm doing, I created a form view using CF and HTML which mimics visually like a paper invoice. Invoice line items can be added in dynamically via AJAX. There's a bunch of info to be filled out on top (Company name, address, etc), then in the middle there's the invoice lines in a table with column headings, then under it there's more info to fill out including signature fields. This format cannot be changed as it is a requirement.
So the form layout is:
Top section (info including customer info and a bunch of other things)
Middle section (table of invoice line items)
Bottom section (a bunch of other info including signature fields)
Visually on the page the above format is maintained and if there's a lot of invoice line items added, the page just scrolls and the bottom section is still at the end.
An unlimited number of invoice lines can be added so if you simply just print the page, the invoice lines will overflow onto the next page and the "bottom info" including signatures will be on whatever page the last page may be, which is undesired.
I need it so that whatever number of lines that can fit on the first page without having the form overflow be displayed on the first page along with the "bottom info" including signature. The extra lines are displayed on the next pages with headings "Continuation Page" along with the table column headings of the invoice lines.
My solution is to create a "print view" which creates the form with entered info and cfloops the invoice lines query but only loop just enough to fill the first page. If the addition of another row makes the form overflow then I would stop the loop, display the rest of the form with the "bottom info" and signatures so it all fits on the first page nicely, then do a page break with the header "Coninuation Page" and display the invoice line table with column headers and the rest of the invoice line items. Of course if the continuation page is going to overflow then I would need to do a page break and repeat the "Continuation Page" process. The tricky part is how to determine how many lines can actually fit on the page because the length of data in each row varies depending on user input. Maybe only one invoice line row filled with tons of data is all that can fit on the first page without having the form overflow. Maybe it's 10 invoice line rows when little data is entered.
My main purpose is to keep the entire form on the first page. If several invoice line items are added which pushes the bottom of the form onto the next page then I want to display only enough invoice line rows to keep the form on the first page and have a Continuation Page for the rest of the invoice lines that didn't fit on subsequent pages.
Note: The print is done via a print link on the form page which pops up the print view page (without site heading, etc.) in another window. From there they can either print from the browser or click on a print link that does a javascript print. the same "print view" I created to print the invoice nicely is also used for a PDF view created using CFDocument. The number of characters per line is not the same in the generated PDF as the HTML print view so it's even harder to determine how many rows can fit.
If I understand your question correctly, then a PDF generated with CFDocument would seem to be the optimal solution. Using the cfdocumentitem tag you can specify headers and footers, which insure that the content you want appears on the first page. The cfdocument.currentpagenumber variable can be used to insure that it only appears on page one, and that the header on pages 2+ display the "Continuation Page" text that you desire. There is also a way to get the PDF to auto-print using a DDX file, though that is subject to security limitations.
You mention using CFDocument to create a separate print view, but I didn't see an explanation as to why an HTML version was required as well. I apologize if I missed it.
From personal experience with a similar project last year I would tend to recommend against using CSS for this and instead just require a PDF reader. It's possible that someone with more skill than I could make it work easily, but it was nothing but a headache for us and we could never get it to work quite right.
In my application, I have a menu that is defined as follows. Each item on the menu is a node that has the following data attributes:
MenuText : (the text that would appear for that item)
isView : Whether this item is a leaf level item or not
subMenus : if isView is false, then there are multiple menu items under this attribute.
Thus, it is a tree structure that can go till any depth. The items in the menu can change periodically and hence the implementation has to be kept flexible. This data is stored in a plist file and read into an NSArray in the code (already implemented).
I now need to create a slide out menu on the left that will be populated by this data hierarchy. I have created the menu pane and added swipe gestures to it, all of which work fine. The menu has to be a collapsible one where clicking on one menu item expands the subViews below it. If the item clicked on is a view, then a new view is loaded on the rest of the screen with appropriate data.
The problem I am facing is the logic to populate the menu (which is a UITableView) from the NSArray data. The following are the two approaches I came up with.
Create a UITableView with as many sections as there are items at the top level of the menu. Then iterate through the menu items recursively. For each menu item that is not a view (i.e. it has subMenus), create a new section with number of rows equal to the number of subMenus under it. When I come across a menu item that is a view and has no further subMenus, add it as a row to the subsection created for the menu one level above it.
Create a menu with one section and as many rows as the number of menu items at the top level. When a menu item is clicked, insert rows under it to represent its sub-menus. When another menu item on the same level is clicked, collapse the previously expanded menu by deleting the inserted rows. When a menu item with no sub menus is clicked, the rest of the screen is populated with data.
I have tried both the approaches and not been able to go beyond the initial steps. For the first method, I understand that I need to add a UITableView as a part of UITableViewCells, which is good, but I need to do that recursively. For the second approach, I need to know the indexPath of each item clicked which can go to many levels.
I would like some suggestions here about which approach I should take and some guidance over how to go about it. Also, if there is any better way to do this, kindly advice. Thanks.
In my opinion, using UINavigationController is the easiest way. You can push as many UITableViews as you want.
If it doesn't fit your design requirement, you can try expandable UITableViews. There are few open sources:
JKExpandTableView
SDNestedTable
iOS-Tree-Component
Thanks for the responses. I ended up doing this using the following control:
Accordion for iOS
It has served my purpose beautifully and I posted it here so that someone with the same requirement may find it.
Take a look at TLIndexPathTools. It has a "Tree" extension that can do this. Try running the Outline sample project. The main task in adapting the sample project would be to write a recursive function to convert your array of nodes into an array of TLIndexPathTreeItem objects. All of the code in the controller:willChangeNode: method is examples of lazy loading and it doesn't sound like you'd need any of that.
I've been working with a great bit of code LXReorderableCollectionViewFlowLayout (written by Stan Chang Khin Boon). It allows for moving items around in a UICollectionView
I have a collection view with multiple sections. The sections are using a header with several controls in them. I allow the user to create empty sections and drag items into these sections
I using the collection view to show multiple albums of photos. Each section correlates to a different album. Dragging a photo from "Album 1" to "Album 2" works fine when each album already has items in it.
But, if the album (section) is empty, I can't move objects into that empty section.
I think the problem is with "indexPathForItemAtPoint". This method provides the correct NSIndexPath if the section has items in it. But if it's empty, it always returns section = 0, row = 0.
When I cross the border from section "0" into section "1" the NSIndexPath theIndexPathOfSelectedItem goes to 0,0 (section, row). I would have expected it to go to 1,0.
The problem seems to be with "indexPathForItemAtPoint". It isn't taking into consideration that the section might be empty and just defaults to 0, 0 when I cross the border into a different (and empty) section.
Like I said earlier, if there are items already in section "1" then the indexPath is set correctly.
Any ideas on what I'm doing wrong?
I ended up placing a dummy (but invisible) item in the empty section. When I create a new section, I place a dummy value in the section. I make it invisible so that it doesn't show. Anytime I add a new item OR remove an item from a section I test to make sure that the dummy item is there.
IMPORTANT: If there is at least 1 real item in the section, I remove the dummy value. Otherwise, the collection list tries to draw it.
I'm sure there is a better way of doing this. If you know how, please post a new answer.
Hope this helps.