These are chat archives for canjs/canjs

25th
Jan 2019
Ngaosathe
@ThekhoN
Jan 25 12:54
Are there any virtualization plugins/libraries available for canjs? we are trying to render more than 2000 grid rows and it is causing a lot of performance issues :(
Piyush Sharma
@Piyush5767
Jan 25 14:20
@chasenlehara thanks but something really strange, i have checked when i try to load component via db (loading template from db) then its able to call other component ie: keyboard using same tag where as if i include keyboard tag manually in template folder then there is no call have been made
the script for template is same either we called it from db or manually include it in template stache...
apsignifi
@apsignifi
Jan 25 16:42

Can4: i have two DefineMaps,
One has keys ( value is null), the other one has only one of those keys with a value.

emptyAttribute = new DefineMap({
                        'name' : null,
                        'active' : null,
                        'internal_name': null,
                        'header' : null,
                        'specifications' : null,
                        'price' : null,
                        'categories' : null,
                        'qty_enabled' : null,
                        'minimum_qty' : null,
                        'description' : null,
                        'image': null,
                        'reorder_qty': null
                    });

&&


current = new DefineMap({
                        'name' : { default: 'Joe'},
                    });

I want to put all the keys of emptyAttribute in current - except 'name'.

is there an efficient way to do this ?
Kevin Phillips
@phillipskevin
Jan 25 16:47
I usually use lodash (or something like it) for things like this
current.assign( _.omit(emptyAttribute.serialize(), ["name"]) )
that basically creates a normal javascript object from emptyAttribute then removes the name property
then sets all of the key/values from that object onto current
apsignifi
@apsignifi
Jan 25 16:50
thanks.
In this case, I need to dynamically determine which key in current has a value, keep that one unchanged and have all others with null value.
Kevin Phillips
@phillipskevin
Jan 25 16:51
oh ok
then instead of ["name"], use Object.keys(current)
apsignifi
@apsignifi
Jan 25 16:53
thanks. let me try and see
Kevin Phillips
@phillipskevin
Jan 25 16:53
or canReflect.getOwnKeys(current)
either should work
apsignifi
@apsignifi
Jan 25 17:08
didnt work for me
Potentially unhandled rejection [1] ReferenceError: _ is not defined
Kevin Phillips
@phillipskevin
Jan 25 17:10
sorry, that's lodash
so you'll need to install and import it
or write your own if you're not using lodash already
apsignifi
@apsignifi
Jan 25 17:11
okk, let me try installing/importing it.
apsignifi
@apsignifi
Jan 25 17:24
@phillipskevin : Thanks, that worked.
Kevin Phillips
@phillipskevin
Jan 25 17:25
great