Page 1 of 2

Clear a grid?

Posted: Mon Aug 12, 2013 5:39 am
by Brian6028327

I'd like to clear out a grid first so that when I populate it, I can be sure only new information is showing.

I'm trying the following:

var dropDown = Appery("grid_Name");
dropDown.empty();

But this seems to be nuking the whole grid. I would like to keep its structure, etc, and just make it ready to accept new data. Should I try something better?

-thanks


Clear a grid?

Posted: Mon Aug 12, 2013 6:06 am
by Oleg Danchenkov

Hi, Brian.
Try to clear content of the elements.
For example, clear all labels in a grid with name gridName:
Appery("gridName").find("[data-role=appery_label]").text("");


Clear a grid?

Posted: Mon Aug 12, 2013 3:19 pm
by Brian6028327

Hmmm... I haven't gotten it to work yet. I replaced the gridName with the actual one in my app. I tried a few replacements regarding

data-role=appery_label

and also copying and pasting as-is, but no luck. Am I missing something?


Clear a grid?

Posted: Mon Aug 12, 2013 5:06 pm
by Kateryna Grynko

Hi Brian,

What components are used inside the grid?


Clear a grid?

Posted: Mon Aug 12, 2013 6:42 pm
by Brian6028327

It is a grid with 3 columns:
A small thumbnail picture element
Description label
ID # label

I just need to clear it out when a menu item is selected, so it can be re-populated with current data, which may have more or fewer rows.


Clear a grid?

Posted: Mon Aug 12, 2013 7:27 pm
by Kateryna Grynko

Brian,

If you use service for filling page then it refills the grid itself.

Was anything cleaned with the sample code above? Are there any errors in console (F12) ?


Clear a grid?

Posted: Tue Aug 13, 2013 2:48 am
by Brian6028327

Ah ok, I'll just try repopulating it from the REST call. Currently, one of my calls has data and one does not, and that's good, because we want to test for that condition. But with no data I expected the grid to clear out when the service is called and that is not happening - the data from the previous call stays there.

No errors are being thrown, but I must be missing something...


Clear a grid?

Posted: Tue Aug 13, 2013 6:03 am
by Maryna Brodina

Hello! Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a


Clear a grid?

Posted: Tue Aug 13, 2013 3:03 pm
by Brian6028327

Thanks, I'll make a 1 page sample app, so you don't have to navigate 5 screens in with user and password prompts along the way...


Clear a grid?

Posted: Tue Aug 13, 2013 4:48 pm
by Kateryna Grynko

Hi Brian,

Please tell us the shared app name. Let us know if there are any problems.