I am newbie for the SWT and layouts. I have a Composite A inside that I have Section called "Table Contens" inside that i have another composite "Composite B" inside that I am using Table Viewer which uses TableColumnLayout.
All the composite and sections uses Grid layout and
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
My problem is,First time the table will contains 5 rows, So the table size arranges accordingly.If i select another file it will be populated with 10 rows and comes with scrollable.
When i go to another tab and come back to this table viewer tab it refreshes the layout and the height of the viewer adjust for the 10 rows.
If I give height and width manually it is working GridData objectivesectiondata=new GridData(670,150);
But I want the table to resize based on the screen but i need to restrict the height of it.
I know i need to do something with the layout .But I dont know how to do it?
I am in need of this very much.Any Advice ?
THanks in advance
Specify the GridData heightHint value, something like:
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
gridData.heightHint = 150;
Related
Basically, you can do .order(2) on your datatable for example to order by that column.
This works great, however it clears the sort header icons (the two arrows up and down) so you can't see which column is being sorted.
I want to make it sort exactly as if you'd clicked the column header.
The above image is the column header zoomed in with the first row. You can see it's sorting by date as the first arrow is black.
When I call .order() it orders the table by date, but it clears the arrows, like in the bottom one. This is what I'm trying to fix.
Edit - Code:
var addedRow = dataTable.row.add([a, b, moment(someDate).format("DD/MM/YYYY hh:mm:ss"), d]);
dataTable.order(2);
dataTable.draw();
Datatables Order() api is used to get/set ordering applied to the table.
An example code to use Datatables order() :
var table = $('#example').DataTable();
var order = table.order([1,'ASC']);
You can refer the documentation for more function types and example.
There is an angular grid and it has 25 columns. Now only 5 columns are visible on the page and to make other columns visible, I have to do horizontal scroll.
I want the text of all the column headers as grid keeps on scrolling horizontally across. any help from protractor experts?
This question has been asked many times but no solution yet.
Wrote below code but it is giving me the text of visible columns only.
var gridclass= $('.ui-grid-viewport');
var columnheader= $('.ui-grid-columns);
browser.executeScript("$(arguments[0]).scrollLeft(arguments[0].scrollLeft + 20)",gridclass.getWebElement());
columnheader.getText();
Expected: I should get the text of all the columns as grid keep on scrolling
Actual: I am getting the text of only visible columns on the page
Assuming .ui-grid-columns identifies the table row containing the all the column headers can you try using the inner text attribute like so
var columnheaders= $('.ui-grid-columns');
columnheaders.getAttribute('innerText')
Use getAttribute("textContent") instead of getText().
This issue could be due to DOM not render the whole page completely. You could try to set the resolution of browser bigger like 3840 x 2160, then getText() all column headers.
I'm putting together an app where a user can record information about like a sale of an unknown number of items in a business. My question is based on recording the quantity, name, individual price and total price of each item sold in a sale. I've already coded a java computer program where I have a table available on the GUI, the user records the information of one item in a table and if they need more rows there is a button which can be pressed each time a new row is needed. I'm wondering:
A) is there a table component I can use in Codenameone on the GUI and
B) can I have the same concept of pressing a button in order to add a new row to the table?
If this isn't possible, because I've had no luck while researching this topic, does anyone have any suggestions of how I can record an unknown number of items for a sale on one GUI page?
UPDATE:
Here is the code which is in the method that adds a new row to the table container.
protected void onSale_ButtonAction(Component c, ActionEvent event) {
Container tbl = findTbl(c);
TextField txt = new TextField();
ComboBox cmb = new ComboBox();
TextField txt2 = new TextField();
tbl.addComponent(txt);
tbl.addComponent(cmb);
tbl.addComponent(txt2);
tbl.animateLayout(300);
}
The button does add the new row but it changes the table layout by resizing all the components and some aren't visible on the screen. I have used the setWidth() method after declaring each component in hope of changing the size of the component but with no luck. How can I solve this problem, so that the new components are the same size as the very first row of components in the table?
And also, after a random number of rows have been filled in with information, i'd like to read this info and save it to a database. I've done this in a computer java program in a JTable and stored the data into a 2D array and then read from the array into the database. Is this method applicable for the container above?
There are "table components" specifically Table, TableLayout & GridLayout.
Adding a row to each of them is somewhat different, lets assume you use a TableLayout container with the container being tbl and having 2 columns:
tbl.addComponent(cmp1);
tbl.addComponent(cmp2);
tbl.animateLayout(300);
Adds both components and animates them into place.
I have a Dojo Datagrid which has 10 columns and about 400 records of data... it doesn't seem like that much but it is very very slow to scroll...
I have another Datagrid which has some 5k records and it scrolls faster. The only difference between the two is that for one I am specifying the height in pixels and have autoheight turned off...
For the smaller one, I couldn't use height = 100% to fill up its parent div because for some reason it doesn't like a percent height and doesn't even render the grid if I specify a percent height - I have to give it in pixels... if I use autoheight = true, then it fills up its parent div which is what I want but then it loads ALL data in the grid at once and so it doesn't do any lazy loading of the data.
Any ideas how to achieve lazy loading and still be able to use autoheight = true (or be able to expand the grid so that it always fills up the height of its parent div)?
Thanks
autoHeight can be set to a numeric value, which will define the maximum number of rows to display
Would anyone let me know how to refresh a grid depending on your selection from another grid. I'm looking at the example at
http://archive.dojotoolkit.org/nightly/checkout/dojox/data/demos/demo_QueryReadStore_grid.html
Is there is any way that the second grid can be updated once you click on any row in the first one. For example Assume that the first table has only the state names and the second one has the capitals. When I click on the State on the first table I only want to see the capital for that state at the second grid.
Please let me know if you have an answer for me.
Thanks,
I would do it this way, using refresh grid to change the store, and the layout of the other grid if necessary using the text value.
grid.onCellClick = function(e) {
refreshGrid(e.cellNode.innerHTML);
};