Set initialPreferredViewPortSize from the property

Forum to discuss the new web client version of Servoy.

Set initialPreferredViewPortSize from the property

Postby jay.rao » Thu Jun 15, 2017 10:59 am

Hello,


Is it possible to set initialPreferredViewPortSize for any component using component's property?
For e.g i have my spec as below
Code: Select all
"foundset": { "type": "foundset", "pushToServer": "allow","dynamicDataproviders":true,"provideColumnFormats":true, "sendSelectionViewportInitially": true,"initialPreferredViewPortSize":5000}



So is possbile that I can create a property for the same componet and then user can directly choose what initialViewPortSize he/she wants,something similar to this


Code: Select all
"viewPortSize":{"type":"int",default:5000}
"foundset": { "type": "foundset", "pushToServer": "allow","dynamicDataproviders":true,"provideColumnFormats":true, "sendSelectionViewportInitially": true,"initialPreferredViewPortSize":"viewPortSize"}

"viewPortSize":{"type":"int",default:5000} so that they can just input value from the component's property.
I want users to choose size whichever they feel better.
jay.rao
 
Posts: 59
Joined: Mon Apr 10, 2017 1:32 pm

Re: Set initialPreferredViewPortSizefrom the property

Postby Andrei Costescu » Thu Jun 15, 2017 11:38 am

Currently you can't do it in the .spec file like that.

What you could do right now is still have that "viewPortSize" defined in the spec. Maybe call it "initialViewPortSize" or "preferredInitialViewPortSize" :) cause it doesn't force the real viewportSize to be always the same.
Then you can use that to call - from the browser - myFoundsetBrowserValue.setPreferredViewportSize(...).

Another option is setting a complete foundset value into the element's property from server-side scripting (but I suspect you don't want that)
Code: Select all
elements.myFoundsetBasedBean.myFoundset = {
            foundset: myNewFoundset,
            dataproviders: {
                dp1 : "customerName",
                dp2 : "city"
            },
            sendSelectionViewportInitially: false,
            initialPreferredViewPortSize: 15
};


If you really want it in the .spec like you mentioned, support for that could be added I guess. You can create a feature req. for that. The thing is - I am not sure how useful this really is. The component itself could detect how much space it has and adjust that dynamically without the need for a separate "initialViewPortSize" property. So I guess it is useful only for the very first show - before the component really knows how much space it has to work with and that can be useful in case the developer only targets known display sizes with that form/component.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 24 guests

cron