Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

list empty returns javascript error

Hi,

We'll think and update.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

list empty returns javascript error

Hello! Don't save to localStorage hidden element. There is easier way. Instead of empty() delete all elements except those one you use for mapping.
1) For list instead of empty() it's better to use code:
codeAppery('list').find("li").not("[dsid=listItem]").remove();/code
where list - list's name
listItem - item name in list where you map

2) for select instead of empty() use
codeAppery("mobileselectmenu").find("option").not("[_tmpl=true]").remove();/code

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

list empty returns javascript error

It is not working, the hidden element is still removed with this find:

Appery('lstContacten').find('li').not('[dsid="mobilelistitem1_3"]').remove();

When I do a Appery('lstContacten').find('li').not('[dsid="mobilelistitem1_3"]').each(
function(){
alert($(this).prop('outerHTML'));
}

);

I get this:

precode

<li style="display: none;" data-theme="b" data-iconpos="right" data-icon="false" data-wrapperels="div" data-iconshadow="true" data-shadow="false" data-corners="false" class="mobilelistitem1 ui-btn ui-btn-up-b ui-btn-icon-right ui-li ui-li-has-alt ui-first-child ui-last-child"><div class="ui-btn-inner ui-li ui-li-has-alt"><div class="ui-btn-text">
<a id="j_69" name="mobilelistitem1_3" dsid="mobilelistitem1_3" tabindex="3" class="mobilelistitem1 ui-link-inherit">
<h3 class="ui-li-heading">Item 1<&#47;h3>
<&#47;a>
<!-- mobilelistitembtn1_4 -->

Code: Select all

                 <&#47;div><&#47;div><a data-iconpos="notext" data-icon="false" data-wrapperels="span" data-iconshadow="true" data-shadow="false" data-corners="false" title="" id="j_70" data-theme="b" name="mobilelistitembtn1_4" dsid="mobilelistitembtn1_4" class="button mobilesplitbuttonitem1  ui-li-link-alt ui-btn ui-btn-up-b ui-btn-icon-notext"><span class="ui-btn-inner"><span class="ui-btn-text"><&#47;span><span class="ui-btn ui-btn-up-b ui-shadow ui-btn-corner-all ui-btn-icon-notext" title="" data-theme="b" data-iconpos="notext" data-icon="arrow-r" data-wrapperels="span" data-iconshadow="true" data-shadow="true" data-corners="true"><span class="ui-btn-inner"><span class="ui-btn-text"><&#47;span><span class="ui-icon ui-icon-arrow-r ui-icon-shadow">&nbsp;<&#47;span><&#47;span><&#47;span><&#47;span><&#47;a><&#47;li> 

/code/pre

Am I doing something wrong here, because I suppose that this 'li' item is not supposed to be included in the find, since it contains a childelement with dsid="mobilelistitem1_3" ? And because it is wrongly included, it is still deleted with the empty().

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

list empty returns javascript error

We'll check.

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

list empty returns javascript error

For the moment I solved it with this, but if there are a lot of items, it is very inefficient because of the 2 find instructions:

precode

Appery('lstContacten')&#46;find('li')&#46;each(
function(){
var delete = true;
$(this)&#46;find('a[dsid="mobilelistitem1_3"]')&#46;each(
function(){
delete = false;
}
);
if(delete){
$(this)&#46;remove();
}
}
);

/code/pre

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

list empty returns javascript error

Hello! Could you give us your public app link so we can test it, because we can't reproduce the problem.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

list empty returns javascript error

Code generation on Appery.io and Progress.com is different, but in general you've found good solution, but your function is a little bit complicated. It's better to use:
codeAppery('list')&#46;find("li")&#46;filter(function(){return $(this)&#46;find('[dsid=listItem]')&#46;size() == 0})&#46;remove();/code

w
Posts: 0
Joined: Tue Mar 26, 2013 12:30 pm

list empty returns javascript error

Ok, thank you!

Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

list empty returns javascript error

Hello,

I just add service into source page. The datasources empty before I add this service. Now the datasources has one service but when I execute the service I'm getting codeTypeError: context is undefined

elem = context&#46;find("[dsid='" + name + "'], " +/code Image error

Is their any extra step required to add first service to page?

I also print the context value and it's getting undefined.

Thanks

Kirit Vaghela
Posts: 0
Joined: Tue Aug 27, 2013 11:23 am

list empty returns javascript error

Solved : I have just copy whole service from another page so I'm getting error in response mapping.

Return to “Issues”