Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Dynamic Data #172

Open
saravananraj21 opened this issue Dec 18, 2018 · 12 comments
Open

Load Dynamic Data #172

saravananraj21 opened this issue Dec 18, 2018 · 12 comments

Comments

@saravananraj21
Copy link

saravananraj21 commented Dec 18, 2018

Hi! I need to load dynamic data from database. How to do that ?
I want to reduce the text size of headers and table view.
Can you help me regarding this.

@saravananraj21 saravananraj21 changed the title Load Load Dynamic Data Dec 18, 2018
@ISchwarz23
Copy link
Owner

Hi @saravananraj21,
You can add the data to your TableDataAdapter and then trigger a new rendering by calling the notifyDataChanged() method. If you want to enable the user to trigger a refresh (pull to refresh) you could use the pro version. You can test the feature in the Example App in the section "Load Data".
For setting the text size I need to know which TableDataAdapter you are using. If you are using the SimpleTableDataAdapter and SimpleTableHeaderAdapter you can use the setTextSize() method.

@saravananraj21
Copy link
Author

Hi @ISchwarz23.
I have used SortableTableView and loaded the data using SimpleTableDataAdapter . Can you help me how to sort the table and any sample code for that!

@ISchwarz23
Copy link
Owner

To make the SortableTableView SortableTableView, you have to set a comparator for each column that should be sortable, by using the SortableTableView#setColumnComparator() method.
You can find the code of the example app here. But in this example I used domain objects as table data and not string arrays.

@saravananraj21
Copy link
Author

In my case I don't know how many columns and rows of data will be there.I have to set everything dynamically.Is it possible to do that?

@saravananraj21
Copy link
Author

Hi @ISchwarz23
How to change the text size? I am using SimpleTableDataAdapter and tried to change the size using setTextsize() method but getting error! Please share a sample code.

@ISchwarz23
Copy link
Owner

Hi @saravananraj21,
There is not much that can go wrong when setting the text size. Check the API here.
If the error remains, post the error here.

@saravananraj21
Copy link
Author

Hi @ISchwarz23
I am getting error when calling the setTextsize().
error

error1

Can you help me regarding this issue!

@ISchwarz23
Copy link
Owner

Hi,

this is notan TableView issue. The setTextSize() method returns void. This is why you get this "error". To resolve it, just change your code like this:

SimpleTableDataAdapter dataAdapter = new SimpleTableDataAdapter(getActivity(), lstrarr_data);
dataAdapter.setTextSize(10);
dynamic_grid(lint_i).setDataAdapter(dataAdapter);

@saravananraj21
Copy link
Author

Hi @ISchwarz23
Thanks! It worked!

In my case I don't know how many columns and rows of data will be there.I have to set everything dynamically.Is it possible to do that?

Is there any solution for the above?

@ISchwarz23
Copy link
Owner

You can add the data to your TableDataAdapter and then trigger a new rendering by calling the notifyDataChanged() method.
To change the number of columns use the TableColumnModel (like TableColumnWeightModel) and set the number of columns you need using the setColumnCount( int ) method.

@saravananraj21
Copy link
Author

Hi @ISchwarz23
I have a json array of data to form the table.I need the data to be arranged in the table and the table must be sortable. How can I achieve this using SortableTableView?

@ISchwarz23
Copy link
Owner

Please read the section about showing custom data and showing sortable data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants