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

creat link from url in json array #314

Open
Wicko-Design opened this issue Oct 9, 2019 · 0 comments
Open

creat link from url in json array #314

Wicko-Design opened this issue Oct 9, 2019 · 0 comments

Comments

@Wicko-Design
Copy link

Wicko-Design commented Oct 9, 2019

In our json array we have urls that link to specific pages.
How can I add this links to a button in the table?

<table id="job-table" class="table table-bordered">
                        <thead>
                            <tr>
                                <th>title</th>
                                <th>absolute_url</th>
                                <th>jobLink</th>
                                <th>locationName</th>
                                <th>updated_at</th>
                                <th>id</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <script>
                        var $dataTable = $('#job-table');
                        $.getJSON('https://boards-api.greenhouse.io/v1/boards/oni/jobs', ({jobs}) => {
                            if (!jobs) return;
                            const flattenJobs = jobs.map(({title, absolute_url, location, updated_at, id}) => ({
                                title,
                                absolute_url,
                                updated_at,
                                locationName: location.name, 
                                id
                            }));

                            console.log(flattenJobs);
                            $dataTable.dynatable({
                                dataset:{
                                    records: flattenJobs
                                },
                                features: {
                                    paginate: true,
                                    recordCount: true,
                                    sorting: true,
                                    search: true,
                                }
                            });
                        });
                    </script>

Sample json

jobs: 
  0:  
absolute_url: "https://oni.bio/careers?gh_jid=4195285002"
internal_job_id: 4172877002
location:  
name: "Oxford"
metadata: []
id: 4195285002
updated_at: "2019-08-27T10:00:41-04:00"
requisition_id: null
title: "Account Manager"
1:  
absolute_url: "https://oni.bio/careers?gh_jid=4365372002"
internal_job_id: 4305685002
location: 
name: "Oxford"
metadata: []
id: 4365372002
updated_at: "2019-09-03T11:41:03-04:00"
requisition_id: null
title: "Backend Software Engineer (DevOps)"
2:  
absolute_url: "https://oni.bio/careers?gh_jid=4187013002"
internal_job_id: 4165585002
location:  
name: "Oxford"
metadata: []
id: 4187013002
updated_at: "2019-08-27T10:00:41-04:00"
requisition_id: null
title: "C++ Software Engineer"
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

1 participant