EasyUI Forum
September 16, 2025, 03:53:30 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Mobile DataList  (Read 7818 times)
garnold
Newbie
*
Posts: 11


View Profile
« on: October 19, 2016, 02:04:04 PM »

I'm trying to add a valueField to the datalist. I can create a list via the documentation just fine but I need more then just the text. I need to add a value connected to each row. This is an id for the item selected.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 19, 2016, 08:08:49 PM »

You can bind any data rows on the datalist.
Code:
var data = [
{"group":"FL-DSH-01","item":"Tailless"},
{"group":"FL-DSH-01","item":"With tail"},
{"group":"FL-DSH-02","item":"Adult Female"},
{"group":"FL-DSH-02","item":"Adult Male"}
];
$(function(){
$('#dl').datalist({
data: data,
textField: 'item',
groupField: 'group',
textFormatter: function(value){
return '<a href="javascript:void(0)" class="datalist-link">' + value + '</a>';
},
onClickRow: function(index,row){
$('#p2-title').html(row.item);
$.mobile.go('#p2');
}
})
})
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!