Dependant question
Dependant question
Hi, i m trying to build a table where the user write a date on CELL1 and it complete CELL2 :
//DEPENDANT
editor.dependent('CELL1', function(val, data, callback) {
if (val != null) {
console.log('oui'),
editor.field('CELL2').set('0');
}
callback(true);
});
the code above work perfeclty, but i want to add the condition that if the CELL 2 isn't emty, it doesn't set the value to 0. How to do that ? Because the variable val is for CELL1 only. I have tried with differents things like the variable full that i use in render fonction to get value from others cells but nothing work, can you help me pls ?
thx in advance for you time
This question has an accepted answers - jump to answer
Answers
Should do it.
Allan
Thank for your answer but now i have another problem :
Cell 1 is a date
Cell 2 is a dropdown with 3 value possible null, 0 (render as 'non') and 1 (render as 'oui')
here is the code on my condition on dependent:
Case 1 (work as intended) : User enter a date in cell1, cell 2 is autocomplete with value = 0 (render as 'non')
Case 2 (work as inteded) : User modify the date in cell1, cell 2 value doesn't change
Case 3 (work as inteded) : User delete the date in cell1, cell 2 value is also deleted
Case 4 (doesn't work as inteded) : Cell1 is empty, cell2 have a value (0 or 1 render as 'non' or 'oui') -> when i click on the cell to modify the value with inline-editing, the defaut selected value is null and not the value of the cell.
Illustration case 4 :
(Before click)
(when i click on the cell) :
(when i click again on the dropdown) :
Can you show me the configuration for that field, and the data which is being loaded into the DataTable please?
Thanks,
Allan
here is the config for cell2 :
the data in the database is null or 0 or 1 depending on the selected value.
The type is 'ouinon' because i have setup a special filter with searchbuilder that show only the option that i want (because i user server side and it can't show only the options availables in my database), but that have no importance because if i disable the type it's still work the same.
For the case 4, i think when i click on the cell to modify the value with inline-editing, it already go in my dependant condition (see bellow) and that's why the default value in the inline-editing field is null and not the true value of the cell. If i don't modify the value (i have a confirm button on inline-edditing) and exit the field, the true value still there (before click image see above)
Do you have a solution ?
After some testing i m sure it's because when i click on the cell with inline-editing, it already go in the first if condition on my dependent and that's why value select in the dropdown is null and not the true value of the cell...
Apologies, I missed your previous reply. That's the column definition - can you show me the field definition as well please? I'd like to also see the JSON data being used to populate the table (assuming that you are using Ajax). Even better would be if you could link to a page showing the problem.
Thanks,
Allan
is it possible to create a test case with editor ? I can reproduce it if it's possible to have a test case with editor. I think it's gonna be easier for you and i.
Because i use serverside so the json data is directly from my database (which i can't share you the data...). Here is the field definition in staff.php
You can, however, it won't be using your PHP, unless you can just link to your page.
If you can show me the Javascript field definition and the JSON return, that would be useful.
Perhaps also try the debugger to give me a trace please - click the Upload button and then let me know what the debug code is.
Allan