0

I want to create an object of ListGrid component in Smart Client.

isc.ListGrid.create({
  ID: "countryList",
   width:500, height:224, top:50, alternateRecordStyles:true,
   fields:[
     {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},  
     {name:"countryName", title:"Country"},  
     {name:"capital", title:"Capital"},  
     {name:"continent", title:"Continent"}  
]}) ; 

Now countryList is the ID for the ListGrid component .

Let us suppose that this Grid has possess some values and i want to put some other values like values from database and there is a condition that we don't have to override or change previous values.So we need to create a new object of countryList .

How can we achieve this?

claudiobosticco
  • 413
  • 2
  • 8

1 Answers1

1

I don't understand if you need another instance of the same ListGrid, or if you need to display different data in the same ListGrid.

If you need another instance, you could define a class:

isc.defineClass("MyGrid", "ListGrid");
isc.MyGrid.addProperties({
  width:500, height:224, top:50, alternateRecordStyles:true,
  fields:[
    {name:"countryCode", title:"Flag", width:50, type:"image", imageURLPrefix:"flags/16/", imageURLSuffix:".png"},  
    {name:"countryName", title:"Country"},  
    {name:"capital", title:"Capital"},  
    {name:"continent", title:"Continent"}  
  ]
});
isc.MyGrid.create({ID: "countryList"});
isc.MyGrid.create({ID: "countryList2"});

Otherwise, if you need to show different data in the same ListGrid instance, you could do:

  • countryList.setData(newData); // or:
  • dataSource.fetchData(criteria, "countryList.setData(data)"); // or:
  • countryList.fetchData(newCriteria); // if countryList has a dataSource attribute
claudiobosticco
  • 413
  • 2
  • 8
  • i have a list grid with more than 75 fields.Now i made a method having parameter is array of List Grid (var array=ListGrid_ID.getRecord(index);) and i want to use same method for data coming from database,So i need to keep theDB value into new Instance of ListGrid.And i don't know how to make new Instance. – Deepak Sharma May 16 '16 at 03:22
  • i had also tried the above approach that you wrote above but it is showing two list grids on the same screen .i need two object but only on list grid on screen. – Deepak Sharma May 16 '16 at 05:41