Changes in Property Data Source occur in the type/class of nested Custom Controls

Displayed here is a section of our internal log, showcasing the compositeData for 2 distinct custom controls - one being the caller and the other being the callee. This information is captured during the BeforePageLoad event.

The parameter dataSource is passed "as-is", utilizing

dataSource="#{javascript:compositeData.dataSource}

Log Entries

14:37:29.876 {dataSource=com.ibm.xsp.model.domino.wrapped.DominoDocument@379c379c, dataSource2=com.ibm.xsp.model.domino.wrapped.DominoDocument@379c379c}

14:37:29.894 {dataSource=com.ibm.xsp.binding.javascript.JavaScriptValueBinding@31433143, dataSource2=com.ibm.xsp.binding.javascript.JavaScriptValueBinding@32613261}

In the second custom control (invoked by the first), the dataSource experiences an unexpected transformation, rendering it essentially useless.

Inquiry

How could a binding alter its type suddenly, switching from a wrapped DominoDocument to a JavaScriptValueBinding? Furthermore, what steps can be taken to rectify this situation?

PS: dataSource2 was an attempt to transmit a secondary parameter all the way down from the top, linked to the same wrapped NotesDocument.

Temporary Solution

To address the issue of passing the document through a parameter, I have resorted to using the original NotesDocument as specified on the main page. While this serves as a quick fix enabling us to proceed, there remains a desire for clarification regarding this anomaly (whether originating from XPages or my implementation) and guidance on the proper method for handling parameter transmission.

Answer №1

Works seamlessly in my basic demonstration:

Primary XPage

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom">
    <xp:this.data>
        <xp:dominoDocument
            var="document1"
            formName="Test">
        </xp:dominoDocument>
    </xp:this.data>
    <xc:datasource1
        dataSource="#{document1}" />
</xp:view>

Custom Control "datasource1" (first tier)

<?xml version="1.0" encoding="UTF-8"?>
<xp:view
    xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom"
    beforePageLoad="#{javascript:print('1: ' + compositeData.dataSource)}">
    datasource1
    <xp:br />
    <xc:datasource2
        dataSource="#{compositeData.dataSource}" />
</xp:view>

Custom Control "datasource2" (second tier)

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    beforePageLoad="#{javascript:print('2: ' + compositeData.dataSource)}">
    dataSource2
</xp:view>

The server console output correctly displays DominoDocument type for both tiers

HTTP JVM: 1: com.ibm.xsp.model.domino.wrapped.DominoDocument@7ee27ee2
HTTP JVM: 2: com.ibm.xsp.model.domino.wrapped.DominoDocument@7ee27ee2

The data type defined for the "datasource" property does not impact functionality - it works with "string" or "com.ibm.xsp.model.domino.DominoDocumentData".

Possibly, analyzing this example can help identify discrepancies in your code.

Answer №2

Functioning as intended. One method involves passing a static value as a parameter, while the other calculates the parameter.

Rather than attempting to pass the entire document, consider passing the bind string instead. This approach offers greater flexibility, allowing for changes in what you want to bind to (bean, scope, object, etc).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

BroccoliMergeTrees function encountered an unexpected data type while attempting to merge trees: TreeMerger (lint) was expecting a Broccoli node, but received an [object

Since switching to Ubuntu 18.04, I've been trying to set up my Ember development environment but have encountered an issue. While my ember project works fine on Windows, I'm getting the error "BroccoliMergeTrees (TreeMerger (lint)): Expected Broc ...

Navigating Form Submission in Next.js

In this code snippet, I attempted to perform simple addition (ket=name + names). The desired outcome is a numerical sum displayed as “ket”. However, when entering 3 and 6 into the input fields, the result appears as 36 instead of 9. export default fu ...

Unable to access the response body of a POST request from an external API within Firebase Cloud Functions

I am encountering an issue with my cloud function in which it makes an http POST request to the LinkedIn API for retrieving an access token. The main problem is that I am unable to retrieve the `body` of the response as it always turns out to be `undefined ...

Using Jquery and Ajax to add information to a database

One of the challenges I'm facing involves a page with three forms, each containing separate variables that need to be inserted into a MySQL database for viewing. My current script is working fine, even though I am aware that `mySql_` is deprecated but ...

Error encountered: When trying to pass an event and two variables, the function e.preventDefault is not recognized as a valid

As a beginner in JS, I thought I had event handlers figured out. After hours of searching for a solution, I'm stuck. I'm trying to create a carousel, and while it mostly works, when I attempt to pass an event handler and two variables from one fu ...

Verify whether the division contains any elements and does not include specific elements

I previously opened a similar thread, but with the condition that the div does not contain a second element within it. So my previous question was as follows: I have some code that looks like this: <p class="elementWrap"> <label>Phone</l ...

Issue with Mobile NavBar remaining visible after clicking on target element in HTML CSS

On my website, everything works perfectly with the Nav bar except for when I am on mobile. When I click on any href from my Nav Bar, it directs me to the correct location but does not close the Nav Bar afterward. I need it to function this way: After click ...

Unusual perspective of JSON with ng-jsoneditor in AngularJS

Currently, I have integrated ng-jsoneditor into my AngularJS application to display and format JSON data. I found guidance on how to implement this from both here and here. Here is the HTML code snippet: <div ng-jsoneditor="onLoad" ng-model="vm. ...

Numerous column pictures that occupy the entire browser screen

I am looking to create a grid of clickable images that expand to cover the width of the browser window without any space on either side. Ideally, I would like each image to be 180x180px in size, but if it's easier they can resize based on the browser ...

Is there a way to clear the input value in the otp field?

Here is the codepen link I mentioned earlier: https://codepen.io/santoshch/pen/LYxOoWO <button @click="resetNow(id)"></button> resetNow(id){ this.$refs[`input-${id}`].input.value = ""; //In some cases, you may need to u ...

What is the method for verifying a password in the login process when it has been hashed by bcrypt during registration?

Currently in the process of developing a signup and login page using Node.js with Pug, Mongoose, and bcrypt. I am encrypting and storing passwords in the database after registration or sign up. I'm facing an issue with the comparison function as it r ...

Is there a way to pre-load the data prior to the component rendering in ReactJS?

The main goal of my project is to retrieve data from the Google Analytics API and display it as a list. Although I am able to successfully fetch the data from the API, I am encountering an issue when passing it to another component. While I can view the da ...

Is the variable leaping to a superior scope?

A few days back, I encountered a strange bug in my code that has left me puzzled. It appears that a variable declared within a narrower scope is somehow leaking into a broader one. Any insights into what might be going wrong here? Here's a simplified ...

The useReducer function dispatch is being called twice

I can't figure out the reason behind this issue. It seems that when strict mode is enabled in React, the deleteItem function is being executed twice. This results in the deletion of two items instead of just one - one on the first round and another on ...

Combining intersecting objects with interval attributes in an array using javascript

I have encountered similar questions, however, the provided answers do not resolve my specific issue. The data I have is an array of range objects, each with the following properties: start: Integer, indicating the start of the range, end: Integer, indi ...

insert a new user into a MongoDB collection

I am facing an issue with adding a user to my collection called users. The code I'm currently using is: var user1 = { Username: "joonyoftv", Password: "joon123", Email: "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cf ...

What is the process for transforming a nested dictionary in JSON into a nested array in AngularJS?

I am looking to create a form that can extract field values from existing JSON data. The JSON I have is nested with dictionary structures, but I would like to convert them into arrays. Is there a way to write a recursive function that can retrieve the key ...

require.js configuration encountered an error while trying to load jquery-ui for the fancytree plugin

I'm currently attempting to incorporate a jQuery control called fancytree into my project. This control has a dependency on jquery-ui. However, I am encountering an error indicating that jquery-ui has not been loaded from the specified path. In additi ...

Effortlessly submit multiple forms at once with just a single click using the WordPress form

One issue I'm experiencing is that the forms on my site are generated using shortcodes. I have a suspicion that the buttons I created, which lead to submission form1 and then form2, may not be working properly because of this. This is the current set ...

Exploring the capabilities of Socket.IO in Node.js for establishing a connection with an external server

Background: My localhost (referred to as Server A) hosts a node.js server, while an external server running node.js can be found at (known as Server B). Although I lack control or access over Server B, which serves as a dashboard site for an IoT device in ...