Welcome Guest Search | Active Topics | Sign In | Register

assigning value to custom column object containing a select list in Grid Options
Alejandro Carcasson
Posted: Wednesday, February 17, 2010 4:53:17 PM
Rank: Member
Groups: Member

Joined: 2/17/2010
Posts: 11
to add a new line, according to the equalized value assigned to the list of custom column that contains a select list
example

value for new line 666

the column contains a select with the following values:
<option value="111"> value 1 </ option>
<option value="666"> value 6 </ option>

in grid to assign 666 to this column would see see "Value 6"

as is done in javascript or c # code

in master page has some special behavior?
eo_support
Posted: Wednesday, February 17, 2010 8:00:38 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I am not exactly sure what your question is. The feature you are asking is unrelated to master page. So the code should be the same regardless you use a master page or not.

Thanks!
Alejandro Carcasson
Posted: Wednesday, February 17, 2010 9:12:33 PM
Rank: Member
Groups: Member

Joined: 2/17/2010
Posts: 11
Hello
I am importing data from Excel, with this information I want to add items to my grid, this work does well, but when such cells as DateTimeColumn or CustomColumn (contains a select) when editing the loaded values are lost.


sorry for the English, I speak Spanish and I am using a translator:)



example code

function ProcesaDatos()
{

var element = 2;
var Copy= document.getElementById("ctl00_ContentPlaceHolder1_DialogoDetInversion_ctl00_DetalleCarga").value;
var CopyLineas = Copy.split('\r');
var registro="";
for (x = 0; x <= CopyLineas.length-1; x++)
{ registro="";
if(CopyLineas[x]!="")
{
var Columas = CopyLineas[x].split('\t');
element = 2;
for (y = 0; y <= Columas.length - 1; y++)
{ if (element == 3)
{ if (Columas[y].indexOf("Cta.") == -1)
{
registro=registro+ Columas[y]+"|";
}
else
{
registro=registro+ Columas[y].replace("Cta.", "")+"|";
}
}
else
{
registro=registro+ Columas[y]+"|";
}
element = element + 1;
}

addNewItem(registro.substr(0,registro.length-1));

}
}
document.getElementById("ctl00_ContentPlaceHolder1_DialogoDetInversion_ctl00_DetalleCarga").value = "";
eo_GetObject('DialogoDetInversion').close();
}

function addNewItem(registro)
{
var valor=registro.split('|');
//Get the Grid object
var grid = eo_GetObject("DetalleInversion");

//Add a new item
var item = grid.addItem();

//Set cell data
//item.getCell(2).setValue(valor[0]);
item.getCell(2).setValue( Date());
item.getCell(3).setValue(valor[1]);
item.getCell(4).setValue(valor[2]);
item.getCell(5).setValue(valor[3]);
item.ensureVisible();


//Make sure the new item is visible
//item.ensureVisible();
}


<eo:Grid id="DetalleInversion" Width="750px" Height="180px" runat="server"
AllowColumnReorder="True"
ColumnHeaderDescImage="00050105" ColumnHeaderAscImage="00050104" FixedColumnCount="1"
GoToBoxVisible="True" GridLines="Both" BorderColor="#7F9DB9" GridLineColor="220, 223, 228"
ColumnHeaderDividerImage="00050103" Font-Names="Tahoma" Font-Size="8.75pt" BorderWidth="1px"
IsCallbackByMe="False" FullRowMode="False" AllowNewItem="True" EnableKeyboardNavigation="true"
>
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;"></FooterStyle>
<ItemStyles>
<eo:GridItemStyleSet>
<CellStyle CssText="padding-left:8px;padding-top:2px;"></CellStyle>
<FixedColumnCellStyle CssText="border-right: #d6d2c2 1px solid; padding-right: 10px; border-top: #faf9f4 1px solid; border-left: #faf9f4 1px solid; border-bottom: #d6d2c2 1px solid; background-color: #ebeadb; text-align: right"></FixedColumnCellStyle>
</eo:GridItemStyleSet>
</ItemStyles>
<GoToBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; BORDER-TOP: #7f9db9 1px solid; BORDER-LEFT: #7f9db9 1px solid; WIDTH: 40px; BORDER-BOTTOM: #7f9db9 1px solid"></GoToBoxStyle>
<ContentPaneStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;"></ContentPaneStyle>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma"></TextBoxStyle>

</eo:TextBoxColumn>

<eo:DateTimeColumn>
<DatePicker DayHeaderFormat="FirstLetter" DayCellHeight="16" DisabledDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL"
OtherMonthDayVisible="True" DayCellWidth="19" TitleRightArrowImageUrl="DefaultSubMenuIcon"
ControlSkinID="None" SelectedDates="">
<DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid"></DayHoverStyle>
<TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;"></TitleStyle>
<DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid"></DayHeaderStyle>
<DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DayStyle>
<SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></SelectedDayStyle>
<TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
<TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid"></TodayStyle>
<PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;"></PickerStyle>
<OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></OtherMonthDayStyle>
<CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma"></CalendarStyle>
<DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DisabledDayStyle>
<MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px"></MonthStyle>
</DatePicker>
</eo:DateTimeColumn>

</ColumnTemplates>
<Columns>
<eo:RowNumberColumn Width="40"></eo:RowNumberColumn>


<eo:TextBoxColumn Width="1" HeaderText="id" DataField="iIdItems"></eo:TextBoxColumn>
<eo:DateTimeColumn Width="100" HeaderText="Fec. Item" DataField="dSolicitadoItem"></eo:DateTimeColumn>

<eo:CustomColumn Width="200" ClientSideEndEdit="on_end_edit" ClientSideBeginEdit="on_begin_edit"
HeaderText="Rubro">
<EditorTemplate>

<select id="rubros_dropdown" style="width:200px">
<option>-Seleccione Rubro-</option>
<asp:Repeater Runat="server" ID="Rubros">
<ItemTemplate>
<option value="<%#DataBinder.Eval(Container.DataItem, "cCuentaContable")%>"><%#DataBinder.Eval(Container.DataItem, "cCuentaContable")%>-<%#DataBinder.Eval(Container.DataItem, "vDescripcion")%></option>
</ItemTemplate>
</asp:Repeater>
</select>

</EditorTemplate>
</eo:CustomColumn>


<eo:TextBoxColumn Width="300" HeaderText="Descripción" DataField="vDescripcion"></eo:TextBoxColumn>


<eo:MaskedEditColumn HeaderText="Monto USD" DataField="mItem" >
<MaskedEdit>
<eo:MaskedEditSegment Decimals="2" SegmentType="Number"></eo:MaskedEditSegment>
</MaskedEdit>
</eo:MaskedEditColumn>


</Columns>
<ColumnHeaderStyle CssText="background-image:url('00050101');padding-left:8px;padding-top:3px;"></ColumnHeaderStyle>
</eo:Grid>
eo_support
Posted: Wednesday, February 17, 2010 9:54:52 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I believe for DateTimeColumn you must give it a Date value. Date is a built-in JavaScript object:

http://www.w3schools.com/jsref/jsref_obj_date.asp

If you give the cell a string value, it will be ignored.

The reason that your CustomColumn loses value is mostly because of your on_begin_edit handler. The Grid calls on_begin_edit handler to load the value into your UI elements (in this case your select element). So inside your on_begin_edit handler, you should take the cell value (this value you passed in item.getCell(5).setValue(valor[3])) and load that value into your select element (this usually means to set your select element's selectIndex. The Grid does not do this automatically for you because it does not know what your UI logic is.

You also need to handle the on_end_edit correctly so that the Grid will be able to get the new value from your UI element. Please see here for more information about CustomColumn:

http://doc.essentialobjects.com/library/1/grid/custom_column.aspx

Hope this helps.

Thanks!
Alejandro Carcasson
Posted: Wednesday, February 17, 2010 10:42:20 PM
Rank: Member
Groups: Member

Joined: 2/17/2010
Posts: 11
hi
We will review and I mention
thanks
Alejandro Carcasson
Posted: Thursday, February 18, 2010 1:28:27 PM
Rank: Member
Groups: Member

Joined: 2/17/2010
Posts: 11
hi
Column datatime was solved, but the custom column (select) does not reflect the assignment of value, followed all the instructions you gave me .. can you give an example of adding an item related to a custom columnda contain a select with javascript
thanks
attentive to your response
eo_support
Posted: Thursday, February 18, 2010 1:36:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I believe you already have the right sample:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\grid_custom_column_adv
http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\grid_custom_column_adv2

The key for a custom column is that the Grid talks with your custom UI through a fixed interface. So the Grid does not care what you have in your custom column as long as you implement the interface correctly. We will tell you what the interface is and provide you sample implementations of that interface, but we will not go into your custom UIs. For this reason, I would suggest you try with a simple UI (such as a single text box) to get the interface working first. Once you have the interface working, you can then troubleshoot the select part. We do not troubleshoot the select part for you.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.