Page 1 of 3

Change width of grid cell via javascript

Posted: Sun Aug 24, 2014 1:16 pm
by Bob Fludder

Is it possible to change the width of a column in a grid component via javascript ? I'm trying to change the width of the 9th (last) column of a grid so its zero and have the others (that are auto width) dynamically change their width accordingly. Thanks


Change width of grid cell via javascript

Posted: Sun Aug 24, 2014 6:01 pm
by Kateryna Grynko

Hi Bob,

Sure, please use the following code:pre$("[name=mobilegridcellName]").width(value);/preWhere 'mobilegridcellName' is a grid cell name,
'value' is a new width value in pixels.


Change width of grid cell via javascript

Posted: Sun Aug 24, 2014 11:29 pm
by Bob Fludder

Worked perfectly. Thank you.


Change width of grid cell via javascript

Posted: Mon Feb 23, 2015 8:46 pm
by Aeneas McBurney

Hi,

I have tried both of the below and both alerts are giving me the original value of 83, so not changing it. What am I doing wrong?

Have tried....

alert($(this).find("[name=mobilegridcell_255]").width());
$(this).find("[name=mobilegridcell_255]").width("1");
alert($(this).find("[name=mobilegridcell_255]").width());

and .......

alert($(this).find("[name=mobilegridcell_255]").width());
$(this).find("[name=mobilegridcell_255]").width(1);
alert($(this).find("[name=mobilegridcell_255]").width());


Change width of grid cell via javascript

Posted: Mon Feb 23, 2015 9:10 pm
by Evgene Karachevtsev

Hello Aeneas,

Second variant looks right, you don't need to use quotes for width value, as you do in first variant
prealert($(this).find("[name=mobilegridcell_255]").width());
$(this).find("[name=mobilegridcell_255]").width(1);
alert($(this).find("[name=mobilegridcell_255]").width());/pre
Could you please clarify do you have any errors in console?


Change width of grid cell via javascript

Posted: Mon Feb 23, 2015 9:16 pm
by Aeneas McBurney

I am running it from the phone app tester. How do I find errors? The event that is firing this code is a swipe left as I want to give the impression that the columns are moving to the side.


Change width of grid cell via javascript

Posted: Tue Feb 24, 2015 10:34 am
by Maryna Brodina

Hello!

Try using Weinre debugger http://devcenter.appery.io/documentat...


Change width of grid cell via javascript

Posted: Tue Feb 24, 2015 6:55 pm
by Aeneas McBurney

When I type below into the debugger when app is running null is returned.

$(this).find("[name=mobilegridcell_255]").width()

What is it I'm looking for?


Change width of grid cell via javascript

Posted: Tue Feb 24, 2015 8:23 pm
by Aeneas McBurney

I have also tried

var gridcell2=$(this).find("[name=mobilegridcell_271]");
try{
gridcell2.width(50);
alert(gridcell2.width());}
catch(err){
alert(err.message);
}

I get no error but the alert shows original size of 1. It doesn't change to 50 width?


Change width of grid cell via javascript

Posted: Tue Feb 24, 2015 8:50 pm
by Evgene Karachevtsev

Aeneas,

Could you please share your app with support and tell us its name?