plomino / Plomino

Powerful and flexible web-based application builder
33 stars 37 forks source link

Automatically creating Datagrid rows #806

Open AshRaghav opened 7 years ago

AshRaghav commented 7 years ago

Hi,

I have got a dropdown list outside the Datagrid and any value selected should populate a set of rows inside the Datagrid automatically when I save the document. Once the rows are created, I am allowing the user to input values on specific fields inside the Datagrid.

Is there a way to automatically create a set of rows in Datagrid with specific values in the first column based on a particular selection outside the Datagrid?

Thanks.

AshRaghav commented 7 years ago

@ebrehault - any thoughts on this?

Also - I am struggling to validate whether a user has pressed "enter" button against each datagrid row in inline editing. Is there a way to validate this action?

The reason to validate the enter button is because users generally forget to press the enter key and click on the save button at the end of the form, thinking that it'll automatically save the entered datagrid rows. Datagrid seems to be saving values only when we press enter button when using inline editing.

Any ideas is much appreciated. Thanks

ebrehault commented 7 years ago

Regrading creating rows automatically: yes that's possible, in onSave you can set a datagrid (just like any other field value):

context.setItem('mydatagrid', [['first col row1', '', ''], ['first col row2', '', '']])

Regarding inline validation check, I guess a custom js could do that.

AshRaghav commented 7 years ago

Thanks @ebrehault - that would be great. I'm not quite adept with js and especially with validating the button press. I also want to change the label of the button to "Save" rather than "Enter" to make it more meaningful.

Secondly I noticed that if I add multiple rows first without pressing enter on the first row, there appears to be a slightly weird behaviour with saving. It seems to take ages and sometimes doesn't save.

Thirdly, if there are any mandatory fields in the associated form of a datagrid and if a user fails to enter this data, no alert is generated except a spinning wheel which was also confusing me for sometime. Not sure if there is a way to fix this.

Thanks again.

AshRaghav commented 7 years ago

@ebrehault , Also - is there a way to retrieve the parameters sent by aoData.push of Datatables inside plomino formulas?

The reason for this question is because I have dropdown list which is populated based on the selection in the previous form and at the moment I am managing to pass the previous selection through Query string and reading that data in the form associated to the Datagrid.

If I try to edit a previously entered value then the data from Query string is lost and my dropdown list gets bigger than it should. In fact, this method works only with inline editing and Query string is not available if I use the modal format for the Datagrid.