I have a JS function that returns true or false depending on some condition, and this is being done when adding a new row to the table. When I put this function in the Editable field of a column, it returns the proper value but the column is always editable. I wasn't using this function initially and was writing the code directly in the Editable property, but it always said that the value didn't evaluate to a boolean even though the popup said it was. What is going on here and what am I doing wrong?
#Returning true or false to the Editable property does not affect the widget, various Select issues
1 messages · Page 1 of 1 (latest)
Hello! I'm AppBot, here to assist you with your Appsmith queries.
The issue you're facing with the Editable property not evaluating to a boolean might be due to the way the JavaScript function is being used or evaluated. In Appsmith, the Editable property of a column should evaluate to a boolean value (true or false) to determine if the column is editable?5:3?Appsmith Documentation.pdf?.
Here are a few things to check:
- Ensure the Function Returns a Boolean: Make sure your JavaScript function explicitly returns a boolean value. For example:
export default {
isEditable: () => {
// Your condition here
return someCondition ? true : false;
}
}
- Use the Function Correctly in the Editable Property: When using the function in the Editable property, ensure you are calling it correctly. For example:
{?{ JSObject1.isEditable() }?}
-
Check for Errors in the Console: Sometimes, errors in the console can provide more insight into why the evaluation might be failing.
-
Verify the Data Context: Ensure that the data context (like currentRow or any other data reference) used in your function is correct and available at the time of evaluation.
If the issue persists, it might be helpful to check if there are any specific errors or warnings in the Appsmith console that could provide more context. If you need further assistance, feel free to ask!
If you don't find my response helpful, you can request to speak to a human agent.
I need a person because I said I already checked that. Plus, someone needs to fix the formatting on this bot because the example in step 2 is wrong.
Someone from our team will reach out to you on this thread. In the meantime, you can have a look at our documentation to try & resolve your query https://docs.appsmith.com?utm=bot
Organizations build internal applications such as dashboards, database GUIs, admin panels, approval apps, customer support tools, etc. to help improve their business operations. Appsmith is an open-source developer tool that enables the rapid development of these applications. You can drag and drop pre-built widgets to build UI. Connect securely...
Hello! I'm Amelia with Appsmith Support.
Please also share a screenshot of the JS function.
I think there's something really wrong with selects in table columns.
- The sort order of the options does not work. If I change it to label or value it sorts the same.
- The switch for "same options in new row" doesn't work. I have to turn it off and copy-paste the code into the fields for new row and the options.
- The evaluated value for the options in the popup shows an empty array but there are options in the select widget. See attached screenshots.
More things @calm violet :
I fixed some TypeErrors in other widgets that were complaining about keys not existing in the data - because the queries hadn't run yet and this is expected, not an error - and now one of my select columns doesn't show the value even though the evaluated value is in the "computed value" field. The other category column goes blank when adding a new row.
The strangest thing is that I can get those columns to display their value when I put a semi-colon at the end of the options field, which then throws an error.
Before and after screenshots:
What is with all these errors??? I don't have code in most of these widgets, and the ones that do don't have errant semi-colons.
These have been going on since I started using the platform. Maybe these are causing some of my widget code to not execute?
seems to happen when using await but I'm not 100% certain
Returning true or false to the Editable property does not affect the widget, various Select issues
Is there anything I can do to troubleshoot this or help troubleshoot?
You can get rid of most of those errors by cloning the page. The cloned page shouldn't have them. This was due to a recent update and has since been fixed. Can you try this and then let us know what errors you're still seeing in the cloned page? Also, what version of Appsmith are you on?
I'm on v1.48. I copied it and that seems to have fixed those errors. I'll reach back out if I run into the other issues - maybe I can recreate them from scratch. Thanks!