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

Records are not formatted #16

Open
DMoneyEva opened this issue Jan 13, 2017 · 1 comment
Open

Records are not formatted #16

DMoneyEva opened this issue Jan 13, 2017 · 1 comment

Comments

@DMoneyEva
Copy link

This is how my records came out

{"draw":0,"recordsTotal":"1","recordsFiltered":"1","data":[["Hillary","Test",1]]}

What is causing this problem?

@necrophidia
Copy link

i do a temprorary fix by editing file /Util/Datatable.php by adding:

$formattedData = [];
        $fieldNames = $this->getFields();
        foreach ($data as $value) {
            $formattedRow = [];
            $loopIndex = 0;
            foreach ($fieldNames as $fieldKey => $fieldValue) {
                $formattedRow[$fieldKey] = $value[$loopIndex];
                $loopIndex += 1;
            }
            array_push($formattedData, $formattedRow);
        }
        $data = $formattedData;

inside execute() function, in line after array_walk($data, function($val, $key) use ($id_index, &$ids)

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