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
Problem with table view. #99
Comments
Hi @renevl, first I would remove the But the rest looks fine. May you can check if there is some data in Best regards, |
I removed the method and I verified the var res_array but the table still no showing data. |
// Static member variableprivate static ArrayList<Object[]> data_array;
// Passing data though constructor
public cTableAdapter(Context context, ArrayList<Object[]> data) {
super(context, data);
this.data_array = data;
}
On 16 May 2017 9:06 p.m., "renevl" <notifications@github.com> wrote:
I removed the method and I verified the var res_array but the table still
no showing data.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZP-a9xyPiUW9MtrdzraEBf5ZyC4RfGYks5r6a1mgaJpZM4NbuCi>
.
|
When I debugg, the list or the method getRowData return a Object array that have data but the data doesn´t showed in the tableview. |
Please try this adapter: public class cTableAdapter extends TableDataAdapter<Object[]>{
public cTableAdapter(Context context, ArrayList<Object[]> data) {
super(context, data);
}
@Override
public View getCellView(int rowIndex, int columnIndex, ViewGroup parentView) {
switch (columnIndex) {
case 0: return renderColumn0(parentView);
case 1: return renderColumn1(parentView,columnIndex,rowIndex);
default: return renderColumn2(columnIndex,rowIndex);
}
}
private View renderColumn0(ViewGroup parentView) {
View viewfst = getLayoutInflater().inflate(R.layout.table_view_adapter,parentView,false);
CheckBox cellfst = (CheckBox)viewfst.findViewById(R.id.cbx_column);
cellfst.setChecked(false);
return viewfst;
}
private View renderColumn1(ViewGroup parentView,int columnIndex,int rowIndex) {
View view=getLayoutInflater().inflate(R.layout.table_view_adapter_1,parentView,false);
TextView cell = (TextView) view.findViewById(R.id.txt_column);
cell.setText(getRowData(rowIndex)[columnIndex].toString());
return view;
}
private View renderColumn2(int columnIndex, int rowIndex) {
final TextView textView = new TextView(getContext());
textView.setText(getRowData(rowIndex)[columnIndex].toString());
textView.setPadding(20, 10, 20, 10);
return textView;
}
} As improvement: Don't inflate the cell layouts, but create the View itself, like you did in |
I have my code like this:
} |
Put your cursor on front of getRowData(rowIndex) then press Shift + F9
(Debug app). What is return of getRowData? Empty or not?
…On 16 May 2017 11:58 p.m., "renevl" ***@***.***> wrote:
and still no showing data
[image: tableview]
<https://cloud.githubusercontent.com/assets/28716930/26118270/e5aee552-3a2e-11e7-846a-51cb59324f10.png>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#99 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AZP-a820FsEkaJKsRHSV_0kFu4FCQ32Kks5r6dWcgaJpZM4NbuCi>
.
|
getRowData has data |
Strange. When I use the Adapter you posted most recently, I see the data. final ArrayList<Object[]> data = new ArrayList<>();
data.add(new Object[]{"This", "is", "a", "test"});
final SortableTableView<Object[]> tableView = (SortableTableView) findViewById(R.id.tableView);
tableView.setDataAdapter(new cTableAdapter(this, data)); And I see a table like this: |
Do the table has to be SortableTableView? because I put only a TableView. |
No, the SortableTableView just provides the possibility for the user to sort the data. |
and Do I need to create another class? i just use the adapter and the main activity. |
No, you don't need more. As mentioned for me it is working with the code above. I just checked it with the simple TableView and it is also working: final ArrayList<Object[]> data = new ArrayList<>();
data.add(new Object[]{"This", "is", "a", "test"});
final TableView<Object[]> tableView = (TableView) findViewById(R.id.tableView);
tableView.setDataAdapter(new cTableAdapter(this, data)); Can you post the layout file which contains the |
This is the layout |
I guess the issue is, as your layout is pretty complex and the height is set to "wrap_content" the data is inside the table, but the height is 0. So you can try to set the height to an absulute value e.g. 100px. |
Yes, that resolve my problem thank you very much |
Now I need it when I look for different filters, the tableview will refresh. Can I do that? |
Im using this control but when I try to show the data in the tableview, it doesn´t appear anything.
table_products.setVisibility(View.VISIBLE); table_adapter=new cTableAdapter(getBaseContext(),res_array.get(4)); table_adapter.setData_array(res_array.get(4)); table_products.setDataAdapter(table_adapter);
`public class cTableAdapter extends TableDataAdapter<Object[]>
{
}
`
I don´t know what is missing.
The text was updated successfully, but these errors were encountered: