Different Spacing on Dynamic Elements

Hello,

I’ve set up my database and have created a dynamic item page. However, the spacing between my text boxes is static. Is there a way for these to auto adjust, so regardless the character length of the text, it will remove empty space? Here is an example of what is happening.

Editor:
[textbox1][textbox2]

DynamicPage1
Anthony Smith

DynamicPage2
Jim Smith

2 Likes

We do not have support for this with the non-coding product. However, with a little coding it can be done easily - using the dataset onReady event and setting the value in a single text element. formatting the value in code.

Should look like the following

$w.onReady(() => {
  $w('#DATASET').onReady(() => {
    let item = $w('#DATASET').getCurrentItem();
    let value = item.firstName + ' ' + item.lastName;
    $w('#TEXT').text = value; 
  });
});

Figured it out. Thanks!

New to Wix code and looking for a starting point.

Is this the same technique you would use if you were composing an address book where the amount of content is variable? For example, not every entry might have a second line of address information, more than one email address/phone number, etc.

What’s the best option for expanding/collapsing horizontal and vertical space around elements that have no value or that have large values (that require pushing other elements out of the way)?

Hay David,

At this time we do not have this capability. My suggestion is to use a single text element and a bit of code to format a single string.

e.g.

$w('#DATASET1').onReady(() => {
  let item = $w('#DATASET1').getCurrentItem();
  let fullName = `${item.firstname} ${item.lastName}`;
  $w('#textbox1').text = fullName;
})

Hello, thanks for this idea, but I have another issue, I need to link each of the to dynamic links… how can I do that?

[dynamicTextWithLink1] > [dynamicTextWithLink2]

Hello, I love the new database. I have a dynamic page set up. One of my categories is a lengthy text article. I need a way to code the spacing in between paragraphs with in the text. Thanks for your help.