Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 26 17:01
    ibelar ready_for_review #1544
  • Nov 26 16:47
    ibelar synchronize #1544
  • Nov 26 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)

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

    mvorisek on reorganize-action-executor-demo

    (compare)

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

    mvorisek on revert-ua-label

    Revert "UA desc/caption" (compare)

  • Nov 26 10:36

    mvorisek on reorganize-action-executor-demo

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

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

    mvorisek on revert-ua-label

    Revert "Reorganize Action Execu… (compare)

  • Nov 26 10:23
    mvorisek assigned #1545
  • Nov 26 10:23
    mvorisek opened #1545
  • Nov 26 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)

PhilippGrashoff
@PhilippGrashoff
Hi Thomas, can you check the resultign HTML code? Maybe there is a <form> inside a <form>. HTML forbids that, and if so that could very well cause your problems
Modal is directly attached to the <body>, but popup I dont know. For positioning it sensibly it would make sense to have the code next to the triggering element, and that would cause the nested forms
What I meant for Modal is: As Modal code is attached to <body>, it does not cause nested forms
Romans Malinovskis
@romaninsh
‘Required’=>’custom text’
Instead of true.
If not swap from required to mandatory and do your own validation.
Required - UI level. Mandatory - model level.
Thomas Stokkeland
@stokkeland
That you @PhilippGrashoff - that makes sense, i did not test it yet, but if the pupup is attached to a button within the other form.. i will check that out,
Romans Malinovskis
@romaninsh
@domainoverflow haha that’s great to know!
Alex Cicovic
@acicovic
Hello everyone, can anybody send me a discord invite? Thanks! :)
Georgi Hristov
@georgehristov
Alex Cicovic
@acicovic
@georgehristov thanks!
Thomas Stokkeland
@stokkeland
ui 1.7 - Grid with addSelection. Added button in grid menu, and in $btn->on('click') I can return $selection->jsChecked() or take it as a parameter .. but i am failing to figure a way to get that selection value to a modal as a result of that button click. I tried to figure out how UI does it with addModalAction, but i was unable to follow.. I guess what I need is "AddModalBulkAction" of sorts and get selections into my dynamic modal...
Svetlozar Kondakov
@skondakov
Hello - did you try to reload the modal content with passing a parameter - the result of the $selection->jsChecked()
Thomas Stokkeland
@stokkeland
@skondakov I am not familiar with how to pass or reload parameters to a modal? in a regular on-click i know I can do that with $btn->on('click',function($jq, $param) {} , $sel->jsChecked()); but i don't know how to make the same for a modal.. right now is create the modal, then use $modal->set( function($m) { } ); any chance you could explain the reload with parameter please?
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