contenteditable, cannot edit a blank span - java

I am using contenteditable attribute in this way.
${row.pno}.
As the data is retrieved from the DB, few values can be null. I can edit the span with some value. The problem is I cannot edit the blank(null text) span. How can i achieve this.
Thanks and Regards
Adeeb

An element with the contenteditable attribute is editable even if the element is initially empty, as in <span contenteditable></span>. The user just can’t focus on it by clicking on it. But he can use the TAB key to move to the element and then type or paste something.
The conclusions depend on the context. For example, if the span element is the sole content of a table cell, you could set display: block on it, making it occupy the entire. Assuming that other cells imply nonzero width and height for that cell, the editable element would have them too and be clickable.

Related

ControlsFx SpreadsheetView Span

I am using SpreadSheetView of ControlsFX,
With that i am able to span rows/columns using the GridBase utility method like below,
getGrid().spanColumn(2, row, column);
Now, i want to remove this span and revert it to original .
How can i do that ?
I must confess I have not thought of anybody wanting to remove the span..
When you span some cells, the first cell is copied and pasted into the place of others in order to reflect the fact that it is spanning. Therefore, the previous cells are trashed. So the operation cannot be reverted.
But you could reverse the process by reducing the span value of the initial cell, and adding new proper cell in the places where the span is not present anymore.
Don't hesitate to post on our google group to have quicker response : https://groups.google.com/forum/?hl=en#!forum/controlsfx-dev

iText - add Table at the end of last page IF Space available

I am using iText 2.1.7
I write a pdf document for which the page size and contant can differ each time. What i want to achieve is a table at the very last page and at the bottom of that page. I am aware of the method 'writeSelectedRows', but with this it could happen that i overwrite text on the page, because i dont know if there is space for my table.
So in conclusion:
If i have reached the last page i want to add my table at the bottom of the page. But if the table does not fit, i want a new page and on this page i want to add the table at the bottom.
I could not find a solution so far.
Use this http://developers.itextpdf.com/de/node/1910 to calculate the height of a table and then check the available space on a page with PdfWriter.GetVerticalPostition(). You might want to consider your Document.BottomMargin or some other offset in your space calculation. (v4.1.6)
Check out this link:
http://developers.itextpdf.com/content/best-itext-questions-stackoverview/general-questions-about-itext/itext7-how-find-out-current-cursor-position-page
I suppose that once you know the current cursor position on this page, you can write a simple if-statement to add a new page, or not.
Kind regards,
Joris

Submitting form elements in a JQuery Datatable to a servlet

There are check-boxes in a jquery datatable. I want to submit them to a servlet by using submit button. I have defined form tags inside the table but still after formatting all the hidden type elements are passed and checkboxes in the table are not passed to the servlet. It shows null for check-box name reference.
Could anybody please help me to pass those values to java servlet.
It seems the DataTable plugin does not use <input> tags for checkboxes. Have a look at this example in the documentation:
https://datatables.net/extensions/select/examples/initialisation/checkbox.html
It says there:
The checkbox is not an element, but rather a
CSS that uses the :before and :after pseudo elements of the cell to
draw a box and the tick.
So first make sure you understand what elements there really are in your table. Use your browser's "Inspect" tool.
Then, if you are sure what elements are there and if there are really checkboxes, be aware that your servlet will not receive a value of a checkbox that is unchecked. This is very unlucky, but it is the specification:
https://www.w3.org/TR/html401/interact/forms.html#checkbox
Therefore, your servlet must internally initialize its final checkbox value with false. Only it receives a value from the checkbox, the final checkbox value will become true. So it might be the right thing that you receive null - then the checkbox was simply not checked.

GWT Hide A Cell of a Grid Panel

Is it possible to hide a complete cell of a Grid Panel in java GWT?
Now I explain my question in detail:
I have a grid with some labels and textboxes, I want to hide the middle label and textbox, but when I set the visible property as false , it hides the 2 objects but it leaves the space between the 2 rows. How can I do to set those objects visible and the other objects to move up so there is no blank space between the two rows?
GWT Design View
http://s11.postimg.org/jc05zgjkj/gwt_grid_01.png
lblName.setVisible(false);
txtbxName.setVisible(false);
View after apply the visible property to false
http://s15.postimg.org/dnkd2927v/gwt_grid_02.png
Thanks a lot for your help
To hide the whole row you can use:
grid.getRowFormatter().setVisible(rowIndex, false);
Hope you need to hide element from DOM:
Can be done by changing row elements Display property.
Sample Code *
Grid g = new Grid();
int rowNumberToHideFromDom;
g.getRowFormatter().getElement(rowNumberToHideFromDom).getStyle().setDisplay(Display.NONE);
Have a look at the HTML table generated in the browser by your GWT code (preferably when visible is set to false). You may see something like this:
<tbody>
<!-- ... -->
<tr> <!-- hidden row -->
<td><!-- hidden widget --></td>
<td><!-- hidden widget --></td>
<td></td> <!-- The single space within the td element bears importance! -->
</tr>
<!-- ... -->
</tbody>
That empty space is padded because the hidden row still contains one or more td elements that have some whitespace content.
This is caused by the Grid widget's implementation of "empty" cells: when you do not set any content to a Grid's cell, or clear out previously set content, the implementation practically insterts a non-breaking space (nbsp) into that cell. (Have a look at the Grid source: addRows(), clearCell() and createCell().)
This default behaviour can be tricked by setting the innerHTML of the empty cells manually to an empty string:
grid.setHTML(2, 3, "");
Also, I guess that the grid.removeRow(row) workaround mentioned in united's comment may also work, although removing the whole row is a bit more radical If you intend to show the hidden row again, you better stick to solving this by setting empty strings into empty cells.

Element in View port issue [Peculiar]

I am getting the following error in a peculiar fashion.
The point at which the driver is attempting to click on the element was not scrolled into the viewport.
The user story goes like this, if a selection is made in a check group, corresponding div with few fields will be enabled. Similarly for n-number of selection there will be n-number of DIVs. When i select only one option in the div, it works as expected but not for the multiple options.
i have read some stuffs and tried all the possible combination about the above said view port issue. My work around attempts and the outcomes are given below.
1) Tried with the Advanced interaction method. (Action class) - The same exception
2) Accessed with java-script executor- same exception
few more will be updated soon.
I have tried all the combination of locating mechanism. Everything works perfect and the element is in visible mode. But when i perform any operation on the second DIV values i am getting the above said exception.
what can be possibly done to get the element in working mode?
EDIT :
1.The DIV elements all are in view port and they all are accessible individually.
2. Div are enabled as per the check box selected
3.In a scenario, if we choose two check box, after a first selection you can edit the DIV and for the second selection the DIV will not be accessible.
4. both DIVs are identical with respect to the elements/attributes/properties of the elements.
5. When a Active div is edited no other div will be available in the UI.
For some reasons i was not able to produce the Reproducible code here.
i sorted out the problem. There was actually a frame for every DIV. these frames are just hidden after the edit and a fresh frame is opened every time, so when i access the second div i had to choose the latest frame.
i just polled for the number of frame and proceed with the latest one.

Categories