DaveP Posted June 13, 2014 Share Posted June 13, 2014 Update - Just downloaded latest dev version and everything is behaving as it should. No idea what was causing the problem (it occurred using a slightly earlier dev version). Anyhow, everything is good, even if it is Friday 13th! 1 Link to comment Share on other sites More sharing options...
davo Posted June 23, 2014 Share Posted June 23, 2014 Odd, I thought I posted last night but now can't find it, so apologies if this appears else where. I'd like to use the render function and apply a class to the table using the $options Could you provide an example please. Link to comment Share on other sites More sharing options...
Yannick Albert Posted July 9, 2014 Share Posted July 9, 2014 I'm able to reproduce the issue as @DaveP posted. If you create a Repeater-Fieldtype and add a PageTable-Fieldtype to it, we'll get that quirky broken layout. Link to comment Share on other sites More sharing options...
dazzyweb Posted July 30, 2014 Share Posted July 30, 2014 Regarding pageTable as quoted with the comment and answer below: "I was actually thinking this morning about this - currently it is possible for someone to add a new child page manually, but these won't appear in the PageTable field for editing. I wonder if there needs to be a way to prevent this as it could get confusing. " For situations where storing them as children is not what you want, then you'd want to specify your own parent. In fact, most of the time when I use PageTable, I specify my own parent where I want them to live, usually off in /tools/my-field-name/ or something like that. We don't want to prevent that because that would mean the PageTable now owns the children of that page and you couldn't use them for anything else, nor could you have multiple different PageTable fields storing their items as children. If you are in a situation where confusion is resulting from letting PageTable store items as children of the page, then that would be a situation where you'd want to specify what parent they should go to instead. In fact, I think that using PageTable with children is really for specific uses, and using PageTable with a specified parent is the more common use case. I am using pageTable and also see an issue with there being some confusion in some cases with the way child pages are listed whether as children of the page with pageTable or under a specified parent. I think that the editor would most likely think that they can add a new child page manually which would not appear in the PageTable field. Sure it can be pushed to a specified parent but it could still create confusion. Does anyone know of a better way to deal with this? Is there a way to disable a new child page being manually added under a specified parent where the pageTables pages are stored but still able to add them on the page with pageTable field? Link to comment Share on other sites More sharing options...
dazzyweb Posted July 31, 2014 Share Posted July 31, 2014 In the end just put the child pages in a specified parent and moved it under Admin. Now nicely hidden. Link to comment Share on other sites More sharing options...
ryan Posted August 3, 2014 Author Share Posted August 3, 2014 Child pages don't become part of the PageTable unless they are added from the PageTable field. It is possible for a parent to contain multiple children, some PageTable some unrelated. So just adding a child to a parent does not automatically add it to a PageTable (not currently anyway). The relations are tracked with a separate table rather than with a parent/child relationship. Link to comment Share on other sites More sharing options...
Macrura Posted August 3, 2014 Share Posted August 3, 2014 you could also make a module that would automatically add the child pages to the parent's page table if they are created from the page tree, hooking into saveReady on the child page's template... $page = $event->arguments[0]; if($page->parent->my_page_table->has($page)) return; $page->parent->setOutputFormatting(false); $page->parent->my_page_table->add($page); $page->parent->save(); 1 Link to comment Share on other sites More sharing options...
dazzyweb Posted August 3, 2014 Share Posted August 3, 2014 Thanks Macrura. I will look into that. Child pages don't become part of the PageTable unless they are added from the PageTable field. It is possible for a parent to contain multiple children, some PageTable some unrelated. So just adding a child to a parent does not automatically add it to a PageTable (not currently anyway). The relations are tracked with a separate table rather than with a parent/child relationship. Would it be possible to add an option whereby adding a child to the parent is also added to the pageTable but only when the template is connected with the PageTable. So a child would only be added to pageTable when it's template is also a pageTable template. Link to comment Share on other sites More sharing options...
Macrura Posted August 4, 2014 Share Posted August 4, 2014 @dazzyweb - the module i wrote for this does exactly what you are describing... do you need additional info on how to set that up? Link to comment Share on other sites More sharing options...
dazzyweb Posted August 15, 2014 Share Posted August 15, 2014 @Macrura Yes, That would be helpful. How do I set it up to create the desired effect. Is this what you are talking about? https://gist.github....ea20b46e706a6f9 Link to comment Share on other sites More sharing options...
Macrura Posted August 16, 2014 Share Posted August 16, 2014 @dazzyweb - yes, that module would work, and then if you modify it with the code a few posts up, it should do what you want! Link to comment Share on other sites More sharing options...
landitus Posted August 20, 2014 Share Posted August 20, 2014 The Pro fields are looking great! Thanks Ryan. I was wondering what would be the best way to store a running event scorecard. This is a table with 2000+ rows and 15 columns of data, where each runner has its race time and more. This data would then be displayed in an html or a js enhanced data table. The site is a running magazine and there will be a lot of score tables. I guess I would just store and xls or json file in PW and then get into the datatables plugin. But maybe there's a more efficient way with the Pro fields? Link to comment Share on other sites More sharing options...
bwakad Posted September 4, 2014 Share Posted September 4, 2014 This might be a stupid question - and I am considering a question mark on my picture. But I read the http://www.flamingruby.com/blog/processwire-weekly-16/ Then from the PageTable link, I came to this topic, only this topic is ProFieldsTable - so confusing... Ryan mentioned the confusing in this topic and said ...PageTable is part of the ProcessWire core (on the dev branch)... Now, I am running a dev ProcessWire 2.4.11. How does this PageTable look? Where can I find it? Or are we talking here about a newer one (so quick?). Link to comment Share on other sites More sharing options...
adrian Posted September 4, 2014 Share Posted September 4, 2014 The link from PW weekly is to a specific post in this thread where Ryan describes all the ProFields, including the new free PageTable field (last in the list in his post). PageTable is in the core, but not installed by default, so go to Modules > Core and scroll down to PageTable. Install it, then create a new field and you'll have a new option "PageTable" when choosing the field type. Hope that helps to clear things up Link to comment Share on other sites More sharing options...
adrian Posted September 29, 2014 Share Posted September 29, 2014 I've figured out a way to have this work in both scenarios, though still a bit hackish.. https://gist.github.com/outflux3/0a013ea20b46e706a6f9 say you have pages being managed by PageTable, and they all live somewhere other than children of the page managing the pageTable items, and you want to be able to have a visible page reference field on the PageTable items; when editing the item from somewhere other than the PageTable, the module first checks to see if it is already in the PageTable array and if not, it adds it (using the page reference).. when you add it from the page managing the items, i have the users leave out the page reference and then when saving the page, it sets all of the items that don't have the page reference, to the page where they are now associated with.. hope i'm making sense... I think this functionality is now in the core: https://github.com/ryancramerdesign/ProcessWire/commit/3085046112b79ea5eb3fd90ad2476f144fd3d7f4 "Plus, add the ability for PageTable to detect and pick up children that were added via some others means." Link to comment Share on other sites More sharing options...
Macrura Posted September 29, 2014 Share Posted September 29, 2014 @adrian - thanks for commenting on this!... What about in the case where page table fields live under some other single parent, not as children of the page? I guess i still need the custom module for this... For example, now i'm doing a record label site and we have albums as pages and then each track is a page table page on the album. This lets us have a nice formatted track list (page table) in the editor, and the the track (page) itself can hold all sorts of data, like preview, full track stream, duration, track index, grouping, composers, performers etc.. but i do want to hide the tracks–i don't want to confuse the users, to see all of those tracks open up if a user clicks the album title; some of these albums have 40 tracks.. so i decided to store the tracks under a hidden tracks parent page.. So the tracks themselves need a page reference to the album they are from, and this is what the module is supposed to do.. If there were some way to set the visibility of the pagetable pages so that users would not be able to directly interact with them, but still be children of the page, that would actually be the ideal way.. Link to comment Share on other sites More sharing options...
adrian Posted September 29, 2014 Share Posted September 29, 2014 If there were some way to set the visibility of the pagetable pages so that users would not be able to directly interact with them, but still be children of the page, that would actually be the ideal way.. I agree - it might be worth you filing an issue on Github about this and see what Ryan can come up with. Link to comment Share on other sites More sharing options...
Soma Posted September 29, 2014 Share Posted September 29, 2014 You don't need a reference as you already got one, it's the pagetable. You can get the page the entry belongs to via API find. 1 Link to comment Share on other sites More sharing options...
Macrura Posted September 29, 2014 Share Posted September 29, 2014 For the most part i think i could get away without assigning the page-table pages (tracks) redundantly, except in this one situation: i need to populate a page select on this 'track' template, that only looks for other tracks on the same album with the field track_group=2194 (which indicates the start of a track group); return $pages->find("template=track, track_group=2194,album_select={$page->album_select}"); if i could figure out a selector to replace this one which relies on that redundant 'album_select' field, then i could drop the whole reference thing, and use the api for any other output-related stuff.. if the tracks (page-table pages) were children then i could do this: return $pages->find("template=track, track_group=2194,parent={$page->parent}"); if they were repeaters, not sure how to do that would maybe have to use getForPage() though I don't know if there is a selector for that? Link to comment Share on other sites More sharing options...
Soma Posted September 30, 2014 Share Posted September 30, 2014 The pagetable stores the ids of the track. It's like a page field and you can use it to find the album the track is on. 1 Link to comment Share on other sites More sharing options...
Macrura Posted September 30, 2014 Share Posted September 30, 2014 @soma - thanks for helping out.. so how would I find the album the track is on in a single selector, that could be used for returning the list of tracks for that album, that have that particular attribute (track_group=2194) Link to comment Share on other sites More sharing options...
Soma Posted September 30, 2014 Share Posted September 30, 2014 Something like $album = $pages->get("template=album, yourpagetable=$page"); $track = $album->yourpagetable->find("track_group=2194"); 3 Link to comment Share on other sites More sharing options...
Macrura Posted September 30, 2014 Share Posted September 30, 2014 cool - this totally worked... I see the Soma wisdom.. a light has turned on! ( this is in the custom php code to find selectable pages..) $album = $pages->get("template=album, album_tracks_pt=$page"); return $album->album_tracks_pt->find("track_group=2194"); i guess the thing that i wasn't getting is the selector for looking in an array; in the api usage i'm always using has($page), but in selectors it seems the = sign does the same thing, interpreted as 'has' for pagearrays Link to comment Share on other sites More sharing options...
ceberlin Posted October 3, 2014 Share Posted October 3, 2014 I am really looking forward to some documentation for this apparently great module. Link to comment Share on other sites More sharing options...
adrian Posted October 3, 2014 Share Posted October 3, 2014 I am really looking forward to some documentation for this apparently great module. There is actually some pretty good documentation in the first post of the VIP support board for the Table field, so once you have purchased and have access, all the info you need is available, although I agree it should probably be available here: http://processwire.com/api/modules/profields/table/ so the people considering purchasing it can get a better idea of how the API side of things works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now