Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 17:01
    ibelar ready_for_review #1544
  • 16:47
    ibelar synchronize #1544
  • 16:47

    ibelar on add-lookup-to-other-vue-form-control

    improve param name fix select input add select rule test and 1 more (compare)

  • 16:24
    mvorisek commented #1540
  • 16:24
    mvorisek commented #1540
  • 14:21
    bedengler commented #1540
  • 10:54
    mvorisek commented #1546
  • 10:51

    mvorisek on reorganize-action-executor-demo

    (compare)

  • 10:50
    mvorisek synchronize #1546
  • 10:50

    mvorisek on revert-ua-label

    Revert "UA desc/caption" (compare)

  • 10:36

    mvorisek on reorganize-action-executor-demo

    Reorganize Action Executor demo test no window size test bigguer window size and 4 more (compare)

  • 10:35
    mvorisek commented #1546
  • 10:27
    mvorisek assigned #1546
  • 10:27
    mvorisek opened #1546
  • 10:26

    mvorisek on revert-ua-label

    Revert "Reorganize Action Execu… (compare)

  • 10:23
    mvorisek assigned #1545
  • 10:23
    mvorisek opened #1545
  • 10:22

    mvorisek on calendar

    Revert "refactor - Calendar inp… (compare)

  • Nov 25 21:30
    ibelar synchronize #1544
  • Nov 25 21:30

    ibelar on add-lookup-to-other-vue-form-control

    remove test comment (compare)

Thomas Stokkeland
@stokkeland
would be nice if it was $modal->show( $sel->jsChecked() ) but i dont think it is that simple
Svetlozar Kondakov
@skondakov
@stokkeland sure, .. not sure it will work in your case though. So here goes ... most of the UI elements in AgileUI can be hot reloaded .. and during a reload you can pass GET parameters. The reloading is done with this code
new \atk4\ui\jsReload( $ui_element, [ 'selected_items' => $sel->jsChecked() ] )
you can place a simple View element in the modal - get it in a variable and then try to reload it with this code
and then debug and see what you have in GET
Thomas Stokkeland
@stokkeland
hmm.. okay reload an element in the modal on that click? yeah that might work
Thomas Stokkeland
@stokkeland
i couldn't figure out a way to make that work.. not really a UI and JS guy, so not exactly following all the magic concepts of js/jq here. Consier this block:
$myview = $app->add(['View']);
$grid = $myview->add(['Grid']);
$grid->setModel($model);
$grid_selection = $grid->addSelection();
$bulk_button = $grid->menu->addItem('Bulk Operation');

$modal = $myview->add(['Modal','title'=>'Bulk it baby']);

$modal->set(
   function ($m)
   {
       $form = $m->add(['Form']);
       $form->addField('selection_data');
   }
);

$bulk_button->on('click',
   function ($j, $param) use ($modal)
   {
      // $param does right here contain the selection values
      // how do i get it to my modal, e.g. into the selection_data field   
      return [
         $modal->show()         
      ];
   }
   ,[$grid_selection->jsChecked()]
);
Thomas Stokkeland
@stokkeland
i trieda adding a $f = $form->getField('selection_data'); then in the on click return add $f->jsInput()->val($param) but doesnt work since the form havent been created yet
Thomas Stokkeland
@stokkeland
this one works with a static modal - but i don't really want the static modal..
$myview = $app->add(['View']);
$grid = $myview->add(['Grid']);
$grid->setModel($model);
$grid_selection = $grid->addSelection();
$bulk_button = $grid->menu->addItem('Bulk Operation');

$modal = $myview->add(['Modal','title'=>'Bulk it baby']);
$form = $modal->add(['Form']);
$form->addField('selection_data');
$sel = $form->getField('selection_data');

$bulk_button->on('click',
   function ($j, $param) use ($modal,$sel,$form)
   {

      // this form manipulation does not work on a click event
      $form->addField('Test',['required'=>true]);

      // this return works and $param is set, but is not ideal, sine the modal is now quite static   
      return [
         $sel->jsInput()->val($param),
         $modal->show()
      ];
   }
   ,[$grid_selection->jsChecked()]
);
Svetlozar Kondakov
@skondakov
Ahhh I'm afraid the proposed solution is for static modal only
you can't really use it for dynamic modals
I guess someone else should be able to help with this, but there should be a way to pass params to a dynamic modal when loading
I would suggest adding a thread in the ATK forum
Thomas Stokkeland
@stokkeland
okay thank you.. yeah the framework itself does it within grid with "addModalAction" in a row - i am just not able to follow exactly where/how it does it.. I will try the forum. For right now my very dirty workaround is using $_SESSION with a short timeout
FabulousGee
@FabulousGee

Hey guys. Can someone point me at the right direction regarding a problem in my model please? I have got a hasOne relation and want to use it with a given condition.
Like having Model1 and Model2, Model1 hasOne Model2 and when I load Model1 I only want to have Model2's loaded that match a given condition (e.g. ownStuff == true)

I tried several methods already and searched around the forums but either it's a dumb question or nobody else has this issue^^ this is the current code:

$this->hasOne('Resource', [ResourceModel::class, 'their_field'=>'id', 'our_field'=>'Resource_id', 'caption' => 'Ressource']]);
$this->ref('Resource')->addCondition('ownResource', true);

btw. it works fine when I add the condition directly into Model2/ResourceModel - but I want it to work from Model1 :(

PhilippGrashoff
@PhilippGrashoff
Hi, though I do not really understand your use case, if you want to add extra conditions to a reference model, do it like this:
            $this->hasMany('Notification', [
                function() {
                    return (new Notification($this->persistence))->addCondition('model_class', get_class($this));
                },
                'their_field' => 'model_id']);
like this you can add conditions to the reference model
mkrecek234
@mkrecek234
Hi everyone, I have issues to get a) the ui ribbon label decorator working in a grid. With the standard hook getHTMLtags HTML looks right but the left part of the ribbon is missing. b) I can't get date format changed to German style 01.03.2020 - the $config['locale']['date'] does not have any effect on my grid. Can't find anything else on the net. Any help?
mkrecek234
@mkrecek234
BTW - same issue that the dropdown icons for a filtered grid are not visible - using the most recent Agile UI 2.0.4
PhilippGrashoff
@PhilippGrashoff
Hi, to switch to a german date format you have to set it in atk4\ui\Persistence\UI
An instance of that object is always in App. the property name is persistence_ui
so you can set it like $app->persistence_ui->date_format = 'd.m.Y';
mkrecek234
@mkrecek234
Thanks a lot - $app->ui_persistence->date_format worked 👍
Any idea on the UI issues above? Seems to be a CSS issue as the left ribbon part going around the grid is missing - and also the dropdown arrows in the grid header row are not shown (but working)
Svetlozar Kondakov
@skondakov

Hi everyone, I have issues to get a) the ui ribbon label decorator working in a grid. With the standard hook getHTMLtags HTML looks right but the left part of the ribbon is missing. b) I can't get date format changed to German style 01.03.2020 - the $config['locale']['date'] does not have any effect on my grid. Can't find anything else on the net. Any help?

Hello, did you try $this->app->ui_persistence->datetime_format

ahh sorry
this seems answered already
mkrecek234
@mkrecek234
Does anyone have a hint for me why the atk4/ui-develop demo shows nice € amounts, and my version with 'Money' field type does not show € signs? I could not find any trace where to configure that :-(
PhilippGrashoff
@PhilippGrashoff
its also in Persistence/UI IIRC
Svetlozar Kondakov
@skondakov
@mkrecek234 did you try $this->app->ui_persistence->currency
?
Thomas Stokkeland
@stokkeland
i always set $this->ui_persistence->currency = '$';
FabulousGee
@FabulousGee

Hi, though I do not really understand your use case, if you want to add extra conditions to a reference model, do it like this:

            $this->hasMany('Notification', [
                function() {
                    return (new Notification($this->persistence))->addCondition('model_class', get_class($this));
                },
                'their_field' => 'model_id']);

Thanks @PhilippGrashoff for the hint but unfortunately this doesn't work as expected either. I had the problem several times already when trying other workarounds: Fatal Error atk4\data\Exception: Field does not exist
I know that the error normally indicates that the field I am trying to use does not exist in this model so I double and triple checked - it IS there and the name is correct... Indicates that something is wrong already...

As for the use case, we maybe we could try the other way round and talk about the correct way to build the relations first.
Given I want to have two pages in my app. One page shows all existing/created people in a CRUD (PeopleModel). People have a name and a boolean flag "employee". Then there is a second model, the NoteModel which represents a small text attached to a single employee (so it is attached to a PeopleModel with employee = true with the hasOne relation)
The second page should show all notes that are available. With the CRUD right there I want to be able to create new notes for employees only. For now, the table only held employee's notes but when creating a new note, all entities are shown (not only employees) This is why I wanted to add the condition.
Maybe I am wrong with my design in general?

PhilippGrashoff
@PhilippGrashoff
Hi,
If this exception rises, that would mean that Model->init() wasnt executed. That happens when no persistence is passed, e.g:
new SomeModel() //init() not executed
new SomeModel($somePersistence) //like $this->persistence or $app->db. init() is executed
aaaah thanks for the explanation, makes sense
PhilippGrashoff
@PhilippGrashoff
$this->hasOne(
    'people_model_id', 
    [
        function() {
            return (new PeopleModel($this->persistence))->addCondition('employee', 'true');
        },
        'caption' => 'Whateveryoulike' //though hasOne() nowadays pulls caption from referenced model I think
    ]
);
if the field NoteModel is called people_model_id that should do it
try join the new discord chat for faster answers, much more going on there: https://discord.gg/TefeSe
FabulousGee
@FabulousGee

Thanks, that did the trick... I was using another variant of inserting persistence ($this->app->db). I tried "this->persistence" now and it works like a charm. Seems like I have to switch using this variant for the future :-)
So thanks again for the help and patience!

Will look into discord - thx for the heads up!
Stay healthy!

PhilippGrashoff
@PhilippGrashoff
np youre welcome
very strange, I cant see why $this->app->db shouldnt do the same
will point to exactly the same object
mkrecek234
@mkrecek234
Hi Philipp, can you send me another invite for Discord? Guys, looking for a library to send emails eg. via SMTP. Anyone has code already for that?
mkrecek234
@mkrecek234
What I still miss is to add an individual Action Button for delete into a grid - I know, for the pro it is simple, but I struggle to add this (other than adding a addColumn('delete') which does not look nice. I wish we had more code examples for defining actions of buttons (inside a grid, or in the menu of a grid) - this still puzzles me: eg change a record, save it and then show a jsNotify after the modal was close. Delete record. Change field of record and store without modal. All certainly easy, but the examples always only give a alert. 2. What also is corrupted is the rendering of the 'id' inside a link: $table->addColumn('name', new \atk4\ui\TableColumn\Link(['details', 'id' => '{$id}'])); it opens detail, but does not include the link (example ui-develop/table.php)
PhilippGrashoff
@PhilippGrashoff
Marco 'Lubber' Wienkoop
@lubber-de
@mkrecek234 SwiftMailer or PHPMailer are the standards since ages with and do also support SMTP. Both are equally good IMHO https://packagist.org/packages/swiftmailer/swiftmailer
https://packagist.org/packages/phpmailer/phpmailer
Thomas Stokkeland
@stokkeland
horizontal menus.. is there any way to make them wrap/stack on narrow screens?
UI 1.7
PhilippGrashoff
@PhilippGrashoff
@stokkeland sorry for the late reply. I'd check what Fomantic UI offers here, they surely have a solution for this. And if you are lucky, you just have to add 1 or 2 classes to the menu
Thomas Stokkeland
@stokkeland
oh yeah.. from their site looks like it supports stackable, it didnt work when i tried adding just the class, but i'll look into it further