Edit Record using onclick

27193

Hello,

We are retrieving information from iSheet and displaying it in a custom table. Each row in the table has an "Edit Item" button that uses the same onclick function as the regular "Edit" button.

 

When the "Edit Item" button is clicked, the "Edit Record" modal opens with the correct iSheet entry. However, when we try to save any changes, the system displays an unlimited loading icon and the changes are not saved.

 

We are wondering if there is a way to use the "Edit Record" feature in this manner and if there are any configurations that we might be missing.

 

Thanks!

Parents
  • Alex Muscina,

    Hi Alex,

    Firstly, I would state that this isn't a supported function yet, i.e. you cannot add an Edit Sheet Item link, from the FCKEditor link function, for dashboards or wikis.
    I've lost count of the number of years this feature has been repeatedly asked for (in the Client Community).

    Secondly, the function you are calling is an internal function that HighQ have created for use in the iSheet module. So, as you have found, outside of this module the modal this generates does not quite operate how you would want - it breaks!

    Thirdly, if you intend to go down this path then I should warn you that you will need to re-test after every upgrade to Collaborate as your code may now not work as HighQ are under no obligation to make sure your code still works when this function is not meant to be used by you. I would also add that I would only take this path if you or your team have a good grasp of Javascript - otherwise you may be creating "a rod for your own back" where there is now an expectation on your team that this needs to keep working, regardless of upgrade issues.

    Now that's out the way, the reason this is not working for you is because the iSheet modal (form) created - by you calling AddSheetItemCollection.editItem() - is missing a few dependencies that are present in the iSheet module.

    You would have noticed that the column conditions are also broken in your form, and that fields are not displaying or hiding based on their specified conditions.  This is due to a missing global variable (sheetHomePageVar) that would have contained some key configuration details.

    There is also the problem that when you submit the iSheet form, nothing happens. This is due in part to the same issue as above. However, by solving that hurdle you will then be faced with the next: post-operations after the form has been submitted. One of these post-ops is to essentially update the iSheet view with the now modified data-set.  This post-op again requires several dependencies to be present for it to work and not send you to the dreaded "Access restricted" page (error_Permission.action).

    I've attached a library that helps "navigate" these particular features.

    So if you were to include/load the library, then given your example, you would call the library as such:

    // to add an item...
    CommunityExamples.Sheet.addItem({
       siteID:986,
       sheetID:1282
    });
    	
    // to edit an existing item...
    CommunityExamples.Sheet.editItem({
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380
    });
    	
    // to edit an existing item, without prior check to
    // see if site/sheet/view exists...
    CommunityExamples.Sheet.editItem({
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380,
       checkAccess:false
    });
    

    The calls are asynchronous and wrapped in Promises, so you can then/await as you wish:

    CommunityExamples.Sheet.editItem({ 
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380
    }).then(res => {
    	
       // iSheet modal loading/loaded... 
    	
    });

    Again, I'll restate that I would only go down this path if you have the skills and the capacity to support it across future versions of Collaborate.

    Hope this helps,
    Andrew

Reply
  • Alex Muscina,

    Hi Alex,

    Firstly, I would state that this isn't a supported function yet, i.e. you cannot add an Edit Sheet Item link, from the FCKEditor link function, for dashboards or wikis.
    I've lost count of the number of years this feature has been repeatedly asked for (in the Client Community).

    Secondly, the function you are calling is an internal function that HighQ have created for use in the iSheet module. So, as you have found, outside of this module the modal this generates does not quite operate how you would want - it breaks!

    Thirdly, if you intend to go down this path then I should warn you that you will need to re-test after every upgrade to Collaborate as your code may now not work as HighQ are under no obligation to make sure your code still works when this function is not meant to be used by you. I would also add that I would only take this path if you or your team have a good grasp of Javascript - otherwise you may be creating "a rod for your own back" where there is now an expectation on your team that this needs to keep working, regardless of upgrade issues.

    Now that's out the way, the reason this is not working for you is because the iSheet modal (form) created - by you calling AddSheetItemCollection.editItem() - is missing a few dependencies that are present in the iSheet module.

    You would have noticed that the column conditions are also broken in your form, and that fields are not displaying or hiding based on their specified conditions.  This is due to a missing global variable (sheetHomePageVar) that would have contained some key configuration details.

    There is also the problem that when you submit the iSheet form, nothing happens. This is due in part to the same issue as above. However, by solving that hurdle you will then be faced with the next: post-operations after the form has been submitted. One of these post-ops is to essentially update the iSheet view with the now modified data-set.  This post-op again requires several dependencies to be present for it to work and not send you to the dreaded "Access restricted" page (error_Permission.action).

    I've attached a library that helps "navigate" these particular features.

    So if you were to include/load the library, then given your example, you would call the library as such:

    // to add an item...
    CommunityExamples.Sheet.addItem({
       siteID:986,
       sheetID:1282
    });
    	
    // to edit an existing item...
    CommunityExamples.Sheet.editItem({
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380
    });
    	
    // to edit an existing item, without prior check to
    // see if site/sheet/view exists...
    CommunityExamples.Sheet.editItem({
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380,
       checkAccess:false
    });
    

    The calls are asynchronous and wrapped in Promises, so you can then/await as you wish:

    CommunityExamples.Sheet.editItem({ 
       siteID:986,
       sheetID:1282,
       sheetViewID:7183,
       itemID:143380
    }).then(res => {
    	
       // iSheet modal loading/loaded... 
    	
    });

    Again, I'll restate that I would only go down this path if you have the skills and the capacity to support it across future versions of Collaborate.

    Hope this helps,
    Andrew

Children
No Data