html property access

Hi,
from backend, I am I am assigning one value in alt of the html content.






 In front end I am accessing it in the following manner through 
dashboard.panels[i]..headerRef.split("alt=")[1].split("title")[0].replace(/['"]+/g, '').trim()




on run time in console working fine, but in event I ma using in typecsript , it is showing headerRef. is not a property of panels. how can I access it ??? please help




5 Replies 1 reply marked as answer

SS Sharon Sanchez Selvaraj Syncfusion Team May 26, 2021 03:53 PM UTC

Hi RakhiS, 
 
Greetings from Syncfusion Support. 
 
We have checked with your provided screenshots and the code snippets. We would like to inform that we don’t have any specific property related to headerRef in our component. So can you please provide the exact details on what does the term headerRef mean? And we have created a sample over here with the same code snippet inorder to obtain the alt attribute’s value from the panel’s header. 
 
Refer to the code snippet. 
 
 onSaveClick() { 
    let elemany = this.dashboard.panels[2].header 
      .split('alt=')[1] 
      .split('title')[0] 
      .replace(/['"]+/g'') 
      .trim(); 
    console.log(elem); 
  } 
 
 
Refer to the sample. 
 
 
If the issue persists, kindly modify the above sample similar to your scenario with clear details on the issue to provide a better solution.  
 
Please get back to us if you need further assistance. 
 
Regards, 
 
Sharon Sanchez S. 



RA RakhiS May 26, 2021 05:59 PM UTC

i am getting error property split does not exist, if you can see the pop up in screen shot.


and in console getting :



SS Sharon Sanchez Selvaraj Syncfusion Team May 27, 2021 11:55 AM UTC

Hi RakhiS, 
 
We checked with the provided screenshot.  We would like to mention that the reported issue occurs when the specified header with the required attributes are not present within panels. 
 
As you can see in the below snippet shared earlier, the header has the below content. 
 
  header: 
        '<div style="text-align: right;" id="myDiv"><a class="classAdd"><img src="https://blazor.syncfusion.com/demos/images/listview/3.png" alt=51 title="Update Component" width="100" height="100"></a><a class="classDel"><img src="https://blazor.syncfusion.com/demos/images/listview/3.png" width="100" height="100" alt=51 title="Delete Component"></a></div>' 
 
 
So the split occurs based on that. 
 
The header content was given similar to the panel json header content shared in the forum. So can you please check with your panel header’s content as to how it’s obtained?  
 
Refer to the sample: 
 
 
Refer to the screenshot as to how it is obtained in our end. 
 
 
 
If the issue persists, kindly modify the sample above to replicate your issue so that we can assist you promptly. 
 
Regards, 
 
Sharon Sanchez S. 



RA RakhiS May 29, 2021 12:46 AM UTC

Hi,
In console I am getting the property (on run time), but I m not able to access it in code. Please have alook on my post once again last one


SS Sharon Sanchez Selvaraj Syncfusion Team May 31, 2021 08:09 AM UTC

Hi RakhiS, 
 
We have checked with your reported image. Please refer to the below solution as to how the above error can be resolved. 
 
Refer to the code snippet. 
 
   let elemany = (<string>this.dashboard.panels[2].header) 
      .split('alt=')[1] 
      .split('title')[0] 
      .replace(/['"]+/g'') 
      .trim(); 
    console.log(elem); 
 
 
Refer to the modified sample. 
 
 
Refer to the below blog for more details regarding similar issues. 
 
 
Please get back to us if you need further assistance. 
 
Regards, 
 
Sharon Sanchez S.

Marked as answer
Loader.
Up arrow icon