Camillia
asked on
Replace &lt; with <
This is an odd thing I'm working on. It's Kendo grid and I'm close to getting this done.
1. I have this
2. And it looks like this in console.log
3. Then I want to replace that with another text so I do this
4. But now it looks like this ..I see double quotes around it ( I drew red circles around it)
5. Then I look at the html and it looks like this
How can I remove the double quotes OR replace the < and ≶?
1. I have this
var test = grid.wrapper.children(".k-grid-pager").find("span.k-dropdown-wrap").find("span.k-input");
console.log(test[0]);
2. And it looks like this in console.log
<span unselectable="on" class="k-input">1000000</span>
3. Then I want to replace that with another text so I do this
test[0].replaceWith("<span unselectable='on' class='k-input'>All</span>");
4. But now it looks like this ..I see double quotes around it ( I drew red circles around it)
5. Then I look at the html and it looks like this
How can I remove the double quotes OR replace the < and ≶?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just want to change the text 1000000 to all but keep the "span" tag the same.
I'll try tonight and post back. Thanks
I'll try tonight and post back. Thanks
Then just do the first bit
grid.wrapper.children(".k-grid-pager").find("span.k-dropdown-wrap").find("span.k-input").html('all');
ASKER
Thanks. I'll try it tonight and post back.
ASKER
No, didn't work. The reason I want to replace the text 1000000 with ALL is because of Kendo's dropdown in the grid. I have 1000000 as the hightest value and when page loads, I set the text to All. This works.
What doesn't work, is when I switch to another value in the dropdown, for example, 250 and go back to "All". The display goes back to 1000000. I have a change event that should rename it to All and that's what's not working.
1. Page loads and I see all
2. Then I switch to 250, for example
3. Then I choose All again and the display name is back to 1000000
4. I tried both
5. I see this in console
6. For this, I see
That replaceWith should work...even tho I don't think it's the correct solution and yours should work...but if I can replace < ...I should be be ok. Kendo is just odd.
What doesn't work, is when I switch to another value in the dropdown, for example, 250 and go back to "All". The display goes back to 1000000. I have a change event that should rename it to All and that's what's not working.
1. Page loads and I see all
2. Then I switch to 250, for example
3. Then I choose All again and the display name is back to 1000000
4. I tried both
if (pageSize == 1000000) {
var grid = $("#ShipmentWorksheetGrid").data("kendoGrid");
var test = grid.wrapper.children(".k-grid-pager").find("span.k-dropdown-wrap").find("span.k-input");
grid.wrapper.children(".k-grid-pager").find("span.k-dropdown-wrap").find("span.k-input").html('all');
//console.log(test);
$(test[0]).html('all');
console.log(test[0]);
5. I see this in console
6. For this, I see
var test2 = grid.wrapper.children(".k-grid-pager").find("span.k-dropdown-wrap").find("span.k-input").html('all');
console.log(test2);
That replaceWith should work...even tho I don't think it's the correct solution and yours should work...but if I can replace < ...I should be be ok. Kendo is just odd.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can't use that replaceWith but somehow remove and replace the < ?
the replaceWith works....I see the text replaced but just need to fix the < and >
if not doable, it is what it is.
the replaceWith works....I see the text replaced but just need to fix the < and >
if not doable, it is what it is.
@Camilia
Do u mine showing us how did u initialize the grid ?
Do u mine showing us how did u initialize the grid ?
ASKER
Julian, I think I know what you mean by the list being refreshed. I'll try that as well.
Moussa, this is a related question or I can post the code tonight
https://www.experts-exchange.com/questions/28991583/How-to-drill-down-using-class-name-and-find-the-text.html
Moussa, this is a related question or I can post the code tonight
https://www.experts-exchange.com/questions/28991583/How-to-drill-down-using-class-name-and-find-the-text.html
Any way you can easily add this to your grid initialization and you should be good
pageable: {
pageSizes: [ 100,250,400,600,'All' ],
buttonCount: 4,
}
ASKER
Yes and I do that, Moussa, but I want All to be default in the dropdown when page loads. In your line of code, 600 would be the default. That's how kendo works, I guess.
If not doable, it's ok. If I can somehow replace the < with < ...in what I have above, I think that should work. If there's no way to do it, it's ok.
If not doable, it's ok. If I can somehow replace the < with < ...in what I have above, I think that should work. If there's no way to do it, it's ok.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, let me check it tonight and I'll post back.
If you want to change all instances
Open in new window
Or if you only want to change the first oneOpen in new window