NooseLadder Posted October 1, 2013 Share Posted October 1, 2013 Hi, I am looking to create a report generator for my client's admin. I currently have this table from: $bookings = $pages->find("template=the_form_submission, sort=-booking_date"); I would like to have one report template where you can select the fields to appear on the report (like a filter) in select (dropdown) for each column, or just select the fields and auto-generate the appropriate number of columns with headings. This will be for the client to use in the admin. Any help appreciated as always. Link to comment Share on other sites More sharing options...
NooseLadder Posted October 4, 2013 Author Share Posted October 4, 2013 Please say if my request is not clear and I will try to clarify. Link to comment Share on other sites More sharing options...
arjen Posted October 4, 2013 Share Posted October 4, 2013 It's not clear to me You are looking for filters in the adminarea? Could you sketch something you want? That might clear things up. Link to comment Share on other sites More sharing options...
NooseLadder Posted October 4, 2013 Author Share Posted October 4, 2013 I hope the attached image helps. Either that or just have a way to select the fields and the number of columns are created automatically depending on number of fields selected. Link to comment Share on other sites More sharing options...
ryan Posted October 12, 2013 Share Posted October 12, 2013 I think you may be asking for something broader in scope than can be answered in a forum post. There are any number of ways to do it, but I would try and find a good jQuery table plugin (perhaps ajax driven) that provides some of what you already need and take it from there. Retrieving the data to display in your table from ProcessWire will be the easy part. Link to comment Share on other sites More sharing options...
NooseLadder Posted October 13, 2013 Author Share Posted October 13, 2013 Ok thanks Ryan, I'll look at the jQuery option. Link to comment Share on other sites More sharing options...
NooseLadder Posted November 25, 2013 Author Share Posted November 25, 2013 (edited) I've finally got round to looking at this. Would Soma's DataTable module be a good starting point for this? If I create a template with the required fields for my reports and modify the module markup accordingly, would that work? Just thinking a bit further. I've loaded Soma's DataTable module. I wouldn't know how to go about this, but it looks as though the module is part-way towards what I am trying to achieve. There is a selector/fllter for the Templates. Could this be extended so that when a template is selected, a selector/filter for the fields in that template can be used to select the columns for the table. Example Template called 'Bookings'. 'Bookings' has the following fields: title, firstName, lastName, dateOfBirth, age, gender, address1, address2, town, postCode, homeTel, mobile, email, courseBooked, bookingDate, courseDate, courseClosingDate, coursePrice, agreeToTerms, depositPaid, invNum. But I only want some of these fields to appear in the DataTable: firstName, lastName, email, courseDate, courseBooked, bookingDate, depositPaid. After the template is selected, I need a filter to select the fields for the DataTable columns, using the field Label as the column heading. Can anyone point me in the right direction please? Edited November 26, 2013 by NooseLadder Link to comment Share on other sites More sharing options...
ryan Posted November 27, 2013 Share Posted November 27, 2013 I've not had experience with the DataTable module, so replying more to bump the topic up to someone that has. But everything you've mentioned sounds feasible to me (outside of any specific module), but would no doubt involve significant development. Link to comment Share on other sites More sharing options...
joey102030 Posted December 5, 2013 Share Posted December 5, 2013 NooseLadder, I have a requirement for something like this. I've had a look at the different options for returning a JSON containing specific data, which could then be fed straight into a JQuery reporting plugin (eg dataTables). The problem with selectors is they don't allow you to specify which fields should be returned. I've looked at creating a specific page in the front-end which could take a selector AND a list of fields as a query string and just return a JSON, but I think this would be a massive security risk. I'm now looking into the possibility of creating a process in the admin based on ProcessPageSearch, which could accept a list of fields to be returned and return everything as JSON. Link to comment Share on other sites More sharing options...
joey102030 Posted December 5, 2013 Share Posted December 5, 2013 I can now see ProcessPageSearch does exactly what I want with the following example: /page/search/for?parent=/&display=title+modified If called in with ajax it returns a JSON with: id, parent_id, template, path, name as standard, then whatever fields are specified in the 'display' parameter 1 Link to comment Share on other sites More sharing options...
ryan Posted December 23, 2013 Share Posted December 23, 2013 I've looked at creating a specific page in the front-end which could take a selector AND a list of fields as a query string and just return a JSON, but I think this would be a massive security risk. It would be a security risk, which is why ProcessPageSearch only works from the admin side. However, if you grab the ServicePages module, that essentially gives you a safety net/mediator between ProcessPageSearch and your front-end. 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