Jump to content

dotnetic

Members
  • Posts

    1,070
  • Joined

  • Last visited

  • Days Won

    16

Everything posted by dotnetic

  1. Okay guys. This was very hard with much trial & error, but I finally got the solution (which is after all very simple). It is even worth an own blog post on my website: How to disable options in select elements that are already selected in another select element Here is a YouTube video of it in action
  2. Yes, thats true if you show all properties from the start. But this is not what I want, because then I have to show lots of fields. I want to keep the form small and simple, and so the user should only select the properties he wants, instead of seeing them all. My script for disabling the options of a select is mostly ready. Now it just needs to work with multiple InputfieldTables.
  3. Hey guys, thanks for your ideas, but actually none of them would handle my problem. I updated the first post, to clarify things a little bit more. @bernhard Functional fields serve a whole different purpose. HandsOnTable seems not to support a Page Reference field and even if so, it would not prevent a user from entering a property multiple times. @BitPoet Matrix fieldtype is nice but also has the problem of preventing a user from entering a property multiple times. @elabx The properties are defined this way. Seems it was a little bit hard to read, that I already use a page reference field, so I updated my first post. I have some other fields, that work similar to what you described. I display them as checkboxes. but the last checkbox requires the input of an additional information (Umgebungsgeräusche) in a textfield. So I could add an additional textfield for every checkbox, and show them conditionally if a checkbox is selected, but that would make it hundreds of them, and this is why I used ProFields: table for it. I really think the best way is to go with ProFields: Table and disable used options in the Page Reference field (Eigenschaft). I will post my solution here as soon as it's ready.
  4. I am looking for the best (or at least a good) way to assign multiple properties to a real world object (a room in my case). The number of properties should be random (because my customer can add as many properties as he wants), but each property should be assigned to the room only once. So right now I have a ProFields: Table with two fields: a page field for the property and another one for a description to the property (it is very important to have a description field for the property). The property (Eigenschaft) field is a page field (Page reference) which has a reference to pages which my customer can configure himself. It is displayed as an select input. Most of the time the users are working in the backend, as I am building a software and not a website with it. The problem is, that I can assign the same property multiple times. What would be the best way so I can select a property only once? Sure I could tell my customer that only the first appearabce of a property he used, would be saved, but a good UI also prevents users from doing so. It is always bad, if a user has to remember how to do things, because then it is not intuitive. So if he is allowed to use multiple properties more than once, what does he think, which value is going to be saved/used? How would I handle this on the server-side? Add a hook before Page::saveReady? Any help is appreciated. Solution: I developed a module Okay guys. This was very hard with much trial & error, but I finally got the solution (which is after all very simple). It is even worth an own blog post on my website: How to disable options in select elements that are already selected in another select element Here is a YouTube video of it in action
  5. Regarding transactions, please also take a look at the newest core addition in 3.0.114 which has a new method $database->supportsTransaction() https://github.com/processwire/processwire/commit/b4aec46a67f7521a0bb8933bf0fb48ae5b9c8303
  6. Please take a look about the new autoheight setting https://www.ag-grid.com/javascript-grid-width-and-height/#auto-height Here is an example where you can switch between a fixed height and autoheight: Example With autoheight enabled the vertical scrollbar appears, which might be a small bug in ag grid, but it doesn't bother me.
  7. @bernhard You should update ag grid to the latest version, as it brings numerous good improvements. See https://www.ag-grid.com/ag-grid-changelog/?fixVersion=18.0.0 and https://www.ag-grid.com/ag-grid-changelog/?fixVersion=19.0.0 I made a quick test with the new version and everything works well in my case. The name of the script has been changed to ag-grid-community.js
  8. I think that autoload order should be an extra setting instead of choosing between boolean|string|callable|int. Because of that you could choose to use a condition and also give it an order. For example, only execute the module in the backend or when a special user role is active, and then load it with high priority.
  9. As https://www.ag-grid.com/javascript-grid-row-styles/#row-class says, you need to modify the gridOptions.rowClassRules for this. Now I found out how to do this. In your javascript file do this: document.addEventListener('RockGridItemAfterInit', function (e) { if (e.target.id != 'RockGridItem_stats') return var grid = RockGrid.getGrid(e.target.id) // set style of all rows to color #cecece remember styles are bad, better use classes grid.gridOptions.rowStyle = {background: '#cecece'}; // this is untested. First is the class to be assigned and second is the condition grid.gridOptions.rowClassRules: { 'rag-green': 'data.age < 20', 'rag-amber': 'data.age >= 20 && data.age < 25', 'rag-red': 'data.age >= 25' } // you can use the grid api like this: // grid.api().sizeColumnsToFit(); //grid.api().setHeaderHeight(48); })
  10. Also I want to know how did you handle translations? For example translating the pager? There are instructions how to at https://www.ag-grid.com/javascript-grid-internationalisation/ but my general problem is understanding how to modify the gridOptions object.
  11. Hi @bernhard. I would like to change the styling/rendering of one or more header columns. For example I want to change the background color. How would I do that? I found this instruction from the aggrid site https://www.ag-grid.com/javascript-grid-header-rendering/ but how would I integrate this into RockGrid? Or is there an easy way to add a class to a specific header column? How do I disable a plugin/button? For example the Excel export button? Somewhere in your code I found document.addEventListener('RockGridButtons.beforeRender', function (e) { // Buttons entfernen if (e.target.id != 'RockGridItem_stats') return var grid = RockGrid.getGrid(e.target.id) var plugin = grid.plugins.buttons // remove a btton plugin.buttons.remove('refresh') }) which does not work. The the listener event is never fired. Also I found document.addEventListener('RockGridItemBeforeInit', function (e) { if (e.target.id != 'RockGridItem_stats') return var grid = RockGrid.getGrid(e.target.id) grid.disablePlugin('excel'); }) which also doesn't work.
  12. That is strange, because Textformatters are only active on the frontend and not in the backend (far as I know). I never experienced a real slowdown with this module active and in use. Maybe it has something to do with your database access, because the module caches the embed code in the database. The module also works with multilanguage fields, as I am using it for that purpose on https://p-jentschura.com
  13. I meant this without using a centralized (and included) version number. Just wanted to say that if either the fieldtype or inputfield should change, the version number should be updated in all of the modules accordingly, because I see them as a whole module package.
  14. @bernhard Du bist der Beste ? I will try to optimize my queries tomorrow based on your post. Also some more questions are coming up as I dive in further.
  15. Thanks, that is excactly what I need. Great ideas from Ivan. I had the same, but he was quicker ?
  16. Hey @adrian, is there an API to turn Mail Interceptor on, before I send emails from one of my modules? I would like to catch emails if I am on my local dev server and forgot to enable the Mail Interceptor in the Tracy Debug bar.
  17. If your module is namespaced on top of your .module file <?php namespace ProcessWire; you can use in your functions $this->log // or $this->pages
  18. This does not really help, as I have no field for the RockGrid because it is created on the fly in my Dashboard module. When I created that file "site/assets/RockGrid/fields/yourfield.php", the code to add the moment.js lib works, but now my grid was empty. My stats.php (thats the name of my InputfieldRockGrid) file looked like this: $this->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/moment.min.js'); I think I then have to also copy the code to setup the RockGrid to this file, right? However, I found a much simpler way to add the script, via ProcessWire's own method. So now in my module I have this code, which works: public function __executeRockGrid() { $f = $this->modules->get('InputfieldRockGrid'); $f->name = 'stats'; $f->themeBorder = 'none'; $f->height = 0; $f->pageSize = 50; // set initial pagination to 25 rows $finder = new \ProcessWire\RockFinder('template=stelle', ['title', 'created']); $field = $finder->addField('mitarbeiterId', ['vorname', 'nachname']); $this->config->scripts->add($this->config->urls->siteModules . "FieldtypeRockGrid/lib/moment.min.js"); $f->setData($finder); return $f->render(); } Any complaints doing it this way?
  19. Hey Bernhard, I get an error that moment.js could not be loaded. Then I found a date.md file which says short note: the name of the module in this file is still RockGrid instead of FieldtypeRockGrid. So I tried to do this, but now I get an error `Call to a member function add() on null` What am I doing wrong? Here is my code. I use RockGrid inside of a module: $f = $this->modules->get('InputfieldRockGrid'); $f->rg->assets->add($this->config->paths->siteModules . 'FieldtypeRockGrid/lib/moment.min.js'); $f->name = 'stats'; $f->themeBorder = 'none'; $f->height = 0; $f->pageSize = 50; // set initial pagination to 25 rows $finder = new RockFinder('template=stelle', ['title', 'created']); $field = $finder->addField('mitarbeiterId', ['vorname', 'nachname']); // $sql = $finder->getSQL(); // $finder->sql = "SELECT id, SUM(value) AS revenue, DATE_FORMAT(date, '%Y-%m') AS dategroup FROM ($sql) AS tmp GROUP BY dategroup"; // d($finder->getObjects()); $f->setData($finder); return $f->render();
  20. Hey @bernhard. You should change the link to the repo in your first post to https://gitlab.com/baumrock/FieldtypeRockGrid as the URL has changed. Also, is the information that this module is still an alpha correct?
  21. Hi @bernhard. I try to get the path to the result pages but also want a fast query, so I am using $found_in_product_title = new \ProcessWire\RockFinder("title|subheadline%=$qs, limit=25, has_parent!=2", ['title', 'name', 'path' => function ($page) {return $page->path;}]); $found_in_product_title = $found_in_product_title->getArrays(); but the path is empty. If I use $found_in_product_title = $found_in_product_title->getObjects(); instead, the path is returned. How can I get an array returned which includes the path to the page? Thanks in advance.
  22. Because it is simply amazing, has an improved user experience, is more lightweight, better looking and has nicer features than version 4. Almost everybody will profit. Please consider voting at github for this feature: https://github.com/processwire/processwire-requests/issues/217
×
×
  • Create New...