How can I get the results from a onclick event render in a new page and window in reactHow to open a pdf file new browser window in javascriptReact JS onClick event handlerReact onClick function fires on renderHow to get parameter value from query stringHow to prevent react router from re-rendering a previously rendered page?How to get history on react-router v4?How to use onClick event on react Link component?React-router not rendering pageHow to make Semantic UI react Search use id instead of title as keyHow to redirect to a new page from a function in React?How to populate div with data from mobx store?
Are there any examples of technologies have been lost over time?
Convert a string like 4h53m12s to a total number of seconds in JavaScript
Why did Saturn V not head straight to the moon?
Is my employer paying me fairly? Going from 1099 to W2
Giant alien flies into the solar system; the rocky planets are its eggs
Integral of the integral using NIntegrate
How can I prevent corporations from growing their own workforce?
Did the IBM PC use the 8088's NMI line?
Unethical behavior : should I report it?
Why was Sauron preparing for war instead of trying to find the ring?
High income, sudden windfall
Why is drive/partition number still used?
Send a single HTML email from Thunderbird, overriding the default "plain text" setting
How do campaign rallies gain candidates votes?
How acidic does a mixture have to be for milk to curdle?
Is there anything wrong with Thrawn?
Weed in Massachusetts: underground roots, skunky smell when bruised
Why didn't Britain or any other European power colonise Abyssinia/Ethiopia before 1936?
Basic Questions on Wiener Filtering
This message is flooding my syslog, how to find where it comes from?
Area of parallelogram = Area of square. Shear transform
How to avoid unconsciously copying the style of my favorite writer?
How can I create a pattern of parallel lines that are increasing in distance in Photoshop / Illustrator?
Is it normal practice to screen share with a client?
How can I get the results from a onclick event render in a new page and window in react
How to open a pdf file new browser window in javascriptReact JS onClick event handlerReact onClick function fires on renderHow to get parameter value from query stringHow to prevent react router from re-rendering a previously rendered page?How to get history on react-router v4?How to use onClick event on react Link component?React-router not rendering pageHow to make Semantic UI react Search use id instead of title as keyHow to redirect to a new page from a function in React?How to populate div with data from mobx store?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to have the results from a onClick event render in a new page and window. I am having a couple issues.
I tried wrapping my rendering of the Pdfs component in a window.open function. This would be too easy and does not work at all.
I tried adding the states that I needed to the history.push function
handleContract = (id) =>
API.openRow(id)
.then(res =>
const pdfs = res.data;
this.setState(pdfs);
this.props.history.push(
pathname: '/pdf',
state: labels:this.state.labels,
contracts:this.state.contracts,
pdfs:this.state.pdfs
)
)
.catch(err => console.log(err));
I get Cannot read property 'map' of undefined on the /pdf page
Here is where the OnClick event is happening in child component and contains the data needed for the /pdf page.
const SearchResults = props => (
<tbody>
props.contracts.map((contract, i) => (
<tr key=i data-id=contract.Id
onClick=() => props.handleContract(contract.Fields.filter(field => field.DataField==="IDXT001").map(field => field.DataValue))
className="clickable-row"
target="_blank">contract.Fields.map( docs =>
<td key=docs.Id><span id=docs.DataField>docs.DataValue</span></td>)
</tr>))
</tbody>
)
On the Parent page..
class SearchPage extends React.Component {
constructor(props)
super(props);
this.state =
labels: [],
contracts: [],
formValues:"",
pdfs:[],
id:"",
;
this.onClick = this.handleContract.bind(this);
<SearchResults
labels=this.state.labels
contracts=this.state.contracts
pdfs=this.state.pdfs
handleContract=this.onClick
/>
My app.js file
<BrowserRouter>
<div>
<Header />
<Route exact path="/" component=Search />
<Route exact path='/pdf' component=Pdf />
<Footer />
</div>
</BrowserRouter>
And my Pdf component..
const Pdfs = props => (
<div className="container">
<div className="row">
props.pdfs.map(contract =>
<div className="col-sm-4" key=contract.Id>
<div className="card scroll">
<div className="card-body">
<p><i className="fas fa-file-pdf fa-lg"></i> <a href=
"http://api/document/" + contract.DocImage.sfScanIndex
className="link"
target="_blank"
rel="noopener noreferrer"
>contract.DocImage.sfFilename</a></p>
<p>contract.Fields.map(docs =>
<div><h6 className="card-title">docs.DisplayName:</h6>
<p className="card-text">docs.DataValue</p>
<hr/>
</div>)
</p>
</div>
</div>
</div>)
</div>
)
Here is a console log of the props in pdfs after I click the tabel row...
match: …, location: …, history: …, staticContext: undefined
history: length: 36, action: "PUSH", location: …, createHref: ƒ, push: ƒ, …
location:
hash: ""
key: "f8b43j"
pathname: "/pdf"
search: ""
state:
contracts: […]
labels: (6) […, …, …, …, …, …]
pdfs: Array(7)
0: Id: 0, Fields: Array(12), DocImage: …
1: Id: 1, Fields: Array(12), DocImage: …
2: Id: 2, Fields: Array(12), DocImage: …
3: Id: 3, Fields: Array(12), DocImage: …
4: Id: 4, Fields: Array(12), DocImage: …
5: Id: 5, Fields: Array(12), DocImage: …
6: Id: 6, Fields: Array(12), DocImage: …
length: 7
__proto__: Array(0)
__proto__: Object
__proto__: Object
match: path: "/pdf", url: "/pdf", isExact: true, params: …
staticContext: undefined
__proto__: Object
I would like the /pdf page to also open in a separate window. To allow the "/" page to remain the same. I tried adding a target="_blank" to the row that is being clicked.
reactjs react-router window.open
add a comment |
I'm trying to have the results from a onClick event render in a new page and window. I am having a couple issues.
I tried wrapping my rendering of the Pdfs component in a window.open function. This would be too easy and does not work at all.
I tried adding the states that I needed to the history.push function
handleContract = (id) =>
API.openRow(id)
.then(res =>
const pdfs = res.data;
this.setState(pdfs);
this.props.history.push(
pathname: '/pdf',
state: labels:this.state.labels,
contracts:this.state.contracts,
pdfs:this.state.pdfs
)
)
.catch(err => console.log(err));
I get Cannot read property 'map' of undefined on the /pdf page
Here is where the OnClick event is happening in child component and contains the data needed for the /pdf page.
const SearchResults = props => (
<tbody>
props.contracts.map((contract, i) => (
<tr key=i data-id=contract.Id
onClick=() => props.handleContract(contract.Fields.filter(field => field.DataField==="IDXT001").map(field => field.DataValue))
className="clickable-row"
target="_blank">contract.Fields.map( docs =>
<td key=docs.Id><span id=docs.DataField>docs.DataValue</span></td>)
</tr>))
</tbody>
)
On the Parent page..
class SearchPage extends React.Component {
constructor(props)
super(props);
this.state =
labels: [],
contracts: [],
formValues:"",
pdfs:[],
id:"",
;
this.onClick = this.handleContract.bind(this);
<SearchResults
labels=this.state.labels
contracts=this.state.contracts
pdfs=this.state.pdfs
handleContract=this.onClick
/>
My app.js file
<BrowserRouter>
<div>
<Header />
<Route exact path="/" component=Search />
<Route exact path='/pdf' component=Pdf />
<Footer />
</div>
</BrowserRouter>
And my Pdf component..
const Pdfs = props => (
<div className="container">
<div className="row">
props.pdfs.map(contract =>
<div className="col-sm-4" key=contract.Id>
<div className="card scroll">
<div className="card-body">
<p><i className="fas fa-file-pdf fa-lg"></i> <a href=
"http://api/document/" + contract.DocImage.sfScanIndex
className="link"
target="_blank"
rel="noopener noreferrer"
>contract.DocImage.sfFilename</a></p>
<p>contract.Fields.map(docs =>
<div><h6 className="card-title">docs.DisplayName:</h6>
<p className="card-text">docs.DataValue</p>
<hr/>
</div>)
</p>
</div>
</div>
</div>)
</div>
)
Here is a console log of the props in pdfs after I click the tabel row...
match: …, location: …, history: …, staticContext: undefined
history: length: 36, action: "PUSH", location: …, createHref: ƒ, push: ƒ, …
location:
hash: ""
key: "f8b43j"
pathname: "/pdf"
search: ""
state:
contracts: […]
labels: (6) […, …, …, …, …, …]
pdfs: Array(7)
0: Id: 0, Fields: Array(12), DocImage: …
1: Id: 1, Fields: Array(12), DocImage: …
2: Id: 2, Fields: Array(12), DocImage: …
3: Id: 3, Fields: Array(12), DocImage: …
4: Id: 4, Fields: Array(12), DocImage: …
5: Id: 5, Fields: Array(12), DocImage: …
6: Id: 6, Fields: Array(12), DocImage: …
length: 7
__proto__: Array(0)
__proto__: Object
__proto__: Object
match: path: "/pdf", url: "/pdf", isExact: true, params: …
staticContext: undefined
__proto__: Object
I would like the /pdf page to also open in a separate window. To allow the "/" page to remain the same. I tried adding a target="_blank" to the row that is being clicked.
reactjs react-router window.open
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
log theprops
object inPdfs
function and see ifpdfs
property exists. The Error says, Can not read property map of undefined.
– Shivam
Mar 26 at 17:39
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
replaceprops.pdfs.map
withprops.location.state.pdfs
in Pdfs component. or pass onlylocation.state.pdfs
as prop to Pdfs component
– Shivam
Mar 26 at 18:03
add a comment |
I'm trying to have the results from a onClick event render in a new page and window. I am having a couple issues.
I tried wrapping my rendering of the Pdfs component in a window.open function. This would be too easy and does not work at all.
I tried adding the states that I needed to the history.push function
handleContract = (id) =>
API.openRow(id)
.then(res =>
const pdfs = res.data;
this.setState(pdfs);
this.props.history.push(
pathname: '/pdf',
state: labels:this.state.labels,
contracts:this.state.contracts,
pdfs:this.state.pdfs
)
)
.catch(err => console.log(err));
I get Cannot read property 'map' of undefined on the /pdf page
Here is where the OnClick event is happening in child component and contains the data needed for the /pdf page.
const SearchResults = props => (
<tbody>
props.contracts.map((contract, i) => (
<tr key=i data-id=contract.Id
onClick=() => props.handleContract(contract.Fields.filter(field => field.DataField==="IDXT001").map(field => field.DataValue))
className="clickable-row"
target="_blank">contract.Fields.map( docs =>
<td key=docs.Id><span id=docs.DataField>docs.DataValue</span></td>)
</tr>))
</tbody>
)
On the Parent page..
class SearchPage extends React.Component {
constructor(props)
super(props);
this.state =
labels: [],
contracts: [],
formValues:"",
pdfs:[],
id:"",
;
this.onClick = this.handleContract.bind(this);
<SearchResults
labels=this.state.labels
contracts=this.state.contracts
pdfs=this.state.pdfs
handleContract=this.onClick
/>
My app.js file
<BrowserRouter>
<div>
<Header />
<Route exact path="/" component=Search />
<Route exact path='/pdf' component=Pdf />
<Footer />
</div>
</BrowserRouter>
And my Pdf component..
const Pdfs = props => (
<div className="container">
<div className="row">
props.pdfs.map(contract =>
<div className="col-sm-4" key=contract.Id>
<div className="card scroll">
<div className="card-body">
<p><i className="fas fa-file-pdf fa-lg"></i> <a href=
"http://api/document/" + contract.DocImage.sfScanIndex
className="link"
target="_blank"
rel="noopener noreferrer"
>contract.DocImage.sfFilename</a></p>
<p>contract.Fields.map(docs =>
<div><h6 className="card-title">docs.DisplayName:</h6>
<p className="card-text">docs.DataValue</p>
<hr/>
</div>)
</p>
</div>
</div>
</div>)
</div>
)
Here is a console log of the props in pdfs after I click the tabel row...
match: …, location: …, history: …, staticContext: undefined
history: length: 36, action: "PUSH", location: …, createHref: ƒ, push: ƒ, …
location:
hash: ""
key: "f8b43j"
pathname: "/pdf"
search: ""
state:
contracts: […]
labels: (6) […, …, …, …, …, …]
pdfs: Array(7)
0: Id: 0, Fields: Array(12), DocImage: …
1: Id: 1, Fields: Array(12), DocImage: …
2: Id: 2, Fields: Array(12), DocImage: …
3: Id: 3, Fields: Array(12), DocImage: …
4: Id: 4, Fields: Array(12), DocImage: …
5: Id: 5, Fields: Array(12), DocImage: …
6: Id: 6, Fields: Array(12), DocImage: …
length: 7
__proto__: Array(0)
__proto__: Object
__proto__: Object
match: path: "/pdf", url: "/pdf", isExact: true, params: …
staticContext: undefined
__proto__: Object
I would like the /pdf page to also open in a separate window. To allow the "/" page to remain the same. I tried adding a target="_blank" to the row that is being clicked.
reactjs react-router window.open
I'm trying to have the results from a onClick event render in a new page and window. I am having a couple issues.
I tried wrapping my rendering of the Pdfs component in a window.open function. This would be too easy and does not work at all.
I tried adding the states that I needed to the history.push function
handleContract = (id) =>
API.openRow(id)
.then(res =>
const pdfs = res.data;
this.setState(pdfs);
this.props.history.push(
pathname: '/pdf',
state: labels:this.state.labels,
contracts:this.state.contracts,
pdfs:this.state.pdfs
)
)
.catch(err => console.log(err));
I get Cannot read property 'map' of undefined on the /pdf page
Here is where the OnClick event is happening in child component and contains the data needed for the /pdf page.
const SearchResults = props => (
<tbody>
props.contracts.map((contract, i) => (
<tr key=i data-id=contract.Id
onClick=() => props.handleContract(contract.Fields.filter(field => field.DataField==="IDXT001").map(field => field.DataValue))
className="clickable-row"
target="_blank">contract.Fields.map( docs =>
<td key=docs.Id><span id=docs.DataField>docs.DataValue</span></td>)
</tr>))
</tbody>
)
On the Parent page..
class SearchPage extends React.Component {
constructor(props)
super(props);
this.state =
labels: [],
contracts: [],
formValues:"",
pdfs:[],
id:"",
;
this.onClick = this.handleContract.bind(this);
<SearchResults
labels=this.state.labels
contracts=this.state.contracts
pdfs=this.state.pdfs
handleContract=this.onClick
/>
My app.js file
<BrowserRouter>
<div>
<Header />
<Route exact path="/" component=Search />
<Route exact path='/pdf' component=Pdf />
<Footer />
</div>
</BrowserRouter>
And my Pdf component..
const Pdfs = props => (
<div className="container">
<div className="row">
props.pdfs.map(contract =>
<div className="col-sm-4" key=contract.Id>
<div className="card scroll">
<div className="card-body">
<p><i className="fas fa-file-pdf fa-lg"></i> <a href=
"http://api/document/" + contract.DocImage.sfScanIndex
className="link"
target="_blank"
rel="noopener noreferrer"
>contract.DocImage.sfFilename</a></p>
<p>contract.Fields.map(docs =>
<div><h6 className="card-title">docs.DisplayName:</h6>
<p className="card-text">docs.DataValue</p>
<hr/>
</div>)
</p>
</div>
</div>
</div>)
</div>
)
Here is a console log of the props in pdfs after I click the tabel row...
match: …, location: …, history: …, staticContext: undefined
history: length: 36, action: "PUSH", location: …, createHref: ƒ, push: ƒ, …
location:
hash: ""
key: "f8b43j"
pathname: "/pdf"
search: ""
state:
contracts: […]
labels: (6) […, …, …, …, …, …]
pdfs: Array(7)
0: Id: 0, Fields: Array(12), DocImage: …
1: Id: 1, Fields: Array(12), DocImage: …
2: Id: 2, Fields: Array(12), DocImage: …
3: Id: 3, Fields: Array(12), DocImage: …
4: Id: 4, Fields: Array(12), DocImage: …
5: Id: 5, Fields: Array(12), DocImage: …
6: Id: 6, Fields: Array(12), DocImage: …
length: 7
__proto__: Array(0)
__proto__: Object
__proto__: Object
match: path: "/pdf", url: "/pdf", isExact: true, params: …
staticContext: undefined
__proto__: Object
I would like the /pdf page to also open in a separate window. To allow the "/" page to remain the same. I tried adding a target="_blank" to the row that is being clicked.
reactjs react-router window.open
reactjs react-router window.open
edited Mar 26 at 17:58
Denis J
asked Mar 26 at 17:14
Denis JDenis J
337 bronze badges
337 bronze badges
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
log theprops
object inPdfs
function and see ifpdfs
property exists. The Error says, Can not read property map of undefined.
– Shivam
Mar 26 at 17:39
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
replaceprops.pdfs.map
withprops.location.state.pdfs
in Pdfs component. or pass onlylocation.state.pdfs
as prop to Pdfs component
– Shivam
Mar 26 at 18:03
add a comment |
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
log theprops
object inPdfs
function and see ifpdfs
property exists. The Error says, Can not read property map of undefined.
– Shivam
Mar 26 at 17:39
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
replaceprops.pdfs.map
withprops.location.state.pdfs
in Pdfs component. or pass onlylocation.state.pdfs
as prop to Pdfs component
– Shivam
Mar 26 at 18:03
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
log the
props
object in Pdfs
function and see if pdfs
property exists. The Error says, Can not read property map of undefined.– Shivam
Mar 26 at 17:39
log the
props
object in Pdfs
function and see if pdfs
property exists. The Error says, Can not read property map of undefined.– Shivam
Mar 26 at 17:39
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
replace
props.pdfs.map
with props.location.state.pdfs
in Pdfs component. or pass only location.state.pdfs
as prop to Pdfs component– Shivam
Mar 26 at 18:03
replace
props.pdfs.map
with props.location.state.pdfs
in Pdfs component. or pass only location.state.pdfs
as prop to Pdfs component– Shivam
Mar 26 at 18:03
add a comment |
1 Answer
1
active
oldest
votes
The prop pdfs
exits inside props.location.state.pdfs
. Either replace props.pdfs.map
with props.location.state.pdfs
in Pdfs component or extract pass only pdfs as prop to Pdfs component
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362776%2fhow-can-i-get-the-results-from-a-onclick-event-render-in-a-new-page-and-window-i%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The prop pdfs
exits inside props.location.state.pdfs
. Either replace props.pdfs.map
with props.location.state.pdfs
in Pdfs component or extract pass only pdfs as prop to Pdfs component
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
add a comment |
The prop pdfs
exits inside props.location.state.pdfs
. Either replace props.pdfs.map
with props.location.state.pdfs
in Pdfs component or extract pass only pdfs as prop to Pdfs component
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
add a comment |
The prop pdfs
exits inside props.location.state.pdfs
. Either replace props.pdfs.map
with props.location.state.pdfs
in Pdfs component or extract pass only pdfs as prop to Pdfs component
The prop pdfs
exits inside props.location.state.pdfs
. Either replace props.pdfs.map
with props.location.state.pdfs
in Pdfs component or extract pass only pdfs as prop to Pdfs component
answered Mar 26 at 18:13
ShivamShivam
1,42716 silver badges34 bronze badges
1,42716 silver badges34 bronze badges
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
add a comment |
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Perfect. thanks for pointing that out. Do you know how I can have that /pdf open in a new window?
– Denis J
Mar 26 at 18:21
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Check this link. stackoverflow.com/q/7727045/3416596
– Shivam
Mar 26 at 18:58
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
Opening the pdf in a new window works fine, by including a target_blank in the "a" tag in the pdfs page. I just want to know how to have the pathway "/pdfs" open in a new tab instead of going to the new pathway on the same page.
– Denis J
Mar 26 at 19:03
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55362776%2fhow-can-i-get-the-results-from-a-onclick-event-render-in-a-new-page-and-window-i%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
check if Fields property exists on contract object
– Shivam
Mar 26 at 17:22
Api is working correctly. I can get the Pdf component to render on the "/" page with the correct data. Just not on "/pdf"
– Denis J
Mar 26 at 17:24
log the
props
object inPdfs
function and see ifpdfs
property exists. The Error says, Can not read property map of undefined.– Shivam
Mar 26 at 17:39
This is in the props in the pdfs function and I click the tr. location: hash: "" key: "f8b43j" pathname: "/pdf" search: "" state: contracts: Array(1) 0: Id: 0, Fields: Array(6), DocImage: … length: 1 proto: Array(0) labels: (6) […, …, …, …, …, …] pdfs: (7) […, …, …, …, …, …, …] proto: Object
– Denis J
Mar 26 at 17:54
replace
props.pdfs.map
withprops.location.state.pdfs
in Pdfs component. or pass onlylocation.state.pdfs
as prop to Pdfs component– Shivam
Mar 26 at 18:03