Have you done inline edit in Notes View? By clicking on a cell, you could edit the value of the field. How would it be in XPages? There are no properties or methods for this, but you can achieve the same result using this technique.
Click here to download the sample database to try this out.
For mapping the view, we will not be using the view Panel. Instead you will have a repeat control whose data source is mapped to the view entries.Inside the repeat control there will be a panel which will be mapped to the individual document . For each cell, there will be two fields, one computed and the other editable. Both the fields will be mapped to the same field.
We will identify which cell is being edited with two viewScopes variables, one for the row and one for the column.
Visibility of CF1 will be return(viewScope.col3!=idx) and
visibility of E1 will be return(viewScope.col3==idx) where idx is index of the repeat control
Clicking on Cell1 will set viewScope.docid to the current document’s id.
E1 will have OnBlur and onKeypress which will save the document.
The onkeypress event will fire whenever you press a character. To restrict this to only tab and enter key, check the keycode for 9(tab) or 13(enter) in client side. When code is entered both in the client and the server side, the client side script will execute first and server side will be executed only if the client side JavaScript returns true.
Now let us see how it works. At first viewscope.col1 will be null, so only the computed field will be displayed.
When you click on cell1, the corresponding row index, col index and docid are set in viewScope.
This will identify which editable field is to be displayed. Type on the editable field and click enter or tab or click outside the field. The document gets saved with the new value.
Tips:
1.Useful for simple notes view. Not suitable for views where column includes complex formula.
2.If your XPage does not contain any other field, put a dummy field. Reason for this at any point, within the panel, only one field will be rendered. If you press the enter key , the entire form will be submitted. This is the default behavior. If there is only one field in the webpage, pressing enter key will submit the form.
3.Keep the computed value formatted and the editable field non formatted for numeric values.
Screenshots:
1.The webpage before editing
2. When clicked for editing
3. Changing to 250 and clicking tab
Can you upload the sample database again?