Working.. But still i need more
Hi,
One think i need to clear that i don’t find any problem with setting the default values for a listgrid field. Using defaultValue or editorProperties i can able to set and it is getting displayed in the field.
But the problem here is if i don't move the control to the field ( which has a default value there) and tried to save the row after giving values to other fields in the row... Its giving the validation error message 'Field is required'( seems like it doesn't consider the default value). This problem persist even after i used 'editProperties'
In your expolorer page – > Go to the ListGird –> Edit new rows-example.. I have attached the code here
isc.ListGrid.create({
ID: "countryList",
width:500, height:224, alternateRecordStyles:true, showAllRecords:true, cellHeight:22,
// use server-side dataSource so edits are retained across page transitions
dataSource: countryDS,
// display a subset of fields from the datasource
fields:[
{name:"member_g8"},
{name:"continent",editorProperties:{defaultValue:["Asia"]},required:true},
{name:"countryName",editorProperties:{defaultValue:["India"]},equired:true},
{name:"population",
formatCellValue:"isc.Format.toUSString(parseInt(value))"},
{name:"independence"}
],
autoFetchData: true,
canEdit: true,
editEvent: "click",
listEndEditAction: "next"
})
//
isc.IButton.create({
top:250,
title:"Edit New",
click:"countryList.startEditingNew()"
});
the above code is not giving me the expected result…
But the second option what you gave me ( sendig default value set to startEditingNew())
is woking filne…
isc.IButton.create({
top:250,
title:"Edit New",
click:"countryList.startEditingNew({continent:'Asia',countryName:'India'})"
});
Ok… My problem is being solved here.. Thanks.
But i would be fine if i get it through the editorProperties.. Since in my appication i made the code more generic. I need 50+ list grids like this.. So that i used the datasource
xml to define all the properteis of a screen. If i am able to this default values for the fields in the datasource xml it will be fine..
Iwill this simpel way ( defining default values in the Datasouce itself) work in future..?
I will be happy with that…
Thanks for this current solution to make it working