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

Table not updating with multiple textviews in item_card #30

Open
felipekaisersoft opened this issue Sep 7, 2018 · 2 comments
Open

Table not updating with multiple textviews in item_card #30

felipekaisersoft opened this issue Sep 7, 2018 · 2 comments
Labels

Comments

@felipekaisersoft
Copy link

Hello,
I've wanted to display a table with 4 TextViews per item, but the table isn't getting updated when I use my modified version of EditItemDialog(to support the 4 TVs I mentioned above).
The data in the csv gets updated immediately, also if I switch to another fragment and back to the table-fragment, the data's displayed correctly!

How can I fix that?

Code handling EditItemDialog response(GH is bugging...):

`

@OverRide
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == EditItemDialog.REQUEST_CODE_EDIT_ITEM && resultCode == Activity.RESULT_OK && data != null) {
int columnIndex = data.getIntExtra(EditItemDialog.EXTRA_COLUMN_NUMBER, 0);
int rowIndex = data.getIntExtra(EditItemDialog.EXTRA_ROW_NUMBER, 0);
String s = data.getStringExtra(EditItemDialog.EXTRA_SUBJECT);
String t = data.getStringExtra(EditItemDialog.EXTRA_TEACHER);
String r = data.getStringExtra(EditItemDialog.EXTRA_ROOM);

        // My attempts to update the layout: 
        mCsvFileDataSource.updateItem(rowIndex, columnIndex,
                CsvFileDataSourceImpl.prepItem(s, t, r));
        mTableAdapter.notifyItemChanged(rowIndex, columnIndex);
        mTableLayout.notifyItemChanged(rowIndex, columnIndex);
        mCsvFileDataSource.applyChanges(getLoaderManager(),
                mTableLayout.getLinkedAdapterRowsModifications(),
                mTableLayout.getLinkedAdapterColumnsModifications(),
                mTableLayout.isSolidRowHeader(),
                ScheduleFragment.this);
        mTableLayout.setVisibility(View.GONE);
        mTableLayout.setVisibility(View.VISIBLE);
        //mTableLayout.invalidate();
        onFileUpdated(StorageUtils.getScheduleFile(getActivity()).getAbsolutePath(), true); // .getScheduleFile() returns File object
    }
}

`

`

public static String prepItem(String s, String t, String r) {
    return s + ";" + t + ";" + r;
}

//...

public String getItemData(int rowIndex, int columnIndex, int position) { // helper method for schedule, splits item and returns data at position's index
    try {
        List<String> rowList = getRow(rowIndex);
        return (rowList == null ? "" : rowList.get(columnIndex)).split(";")[position];
    } catch (Exception e) {
        Log.e(TAG, "get rowIndex=" + rowIndex + "; colIndex=" + columnIndex + "; position:" + position + "\ncache = " +
                mItemsCache.toString(), e);
        return null;
    }
}

`

Best regards,
Felipe

PS: Except for above issue, it works like a charm!

@yarovoiag yarovoiag added the bug label Jan 4, 2019
@samiazar
Copy link

I still have this issue, how do you work out with this problem?

@vyguera
Copy link

vyguera commented Dec 31, 2019

Possible duplicate of #36. If so is fixed on pull request #41

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

No branches or pull requests

4 participants