DineshKanna0905
Member
Hai, I am using Flexgrid Table. As I am new to B4X, I don't know how to add existing Rows to flexgrid table.
I have three edit texts, a spinner, and a button. I fill and these edittexts and then press Add Button. It adds the value into flexgrid table. In the below image(I have 2 rows). Now What is want to do is to cell click the first row and then make changes in either of edit texts or spinner and then press Add button It needs to add existing row(For Ex I have clicked the first row, then I press add button, It need to add in the first row), But it adds as new row as 3rd row. How to do this?
I have three edit texts, a spinner, and a button. I fill and these edittexts and then press Add Button. It adds the value into flexgrid table. In the below image(I have 2 rows). Now What is want to do is to cell click the first row and then make changes in either of edit texts or spinner and then press Add button It needs to add existing row(For Ex I have clicked the first row, then I press add button, It need to add in the first row), But it adds as new row as 3rd row. How to do this?
B4X:
Private Sub btn_ok_Click
If if_flexgrid.RowCount == 0 Then
is_sno = is_sno + 1
Else If if_flexgrid.RowCount > 0 Then
For i = 0 To if_flexgrid.RowCount - 1
Dim ls_sno As Int = if_flexgrid.GetCellValue(i, 0)
is_sno = ls_sno + 1
If is_selectedsno == ls_sno Then
is_sno = is_selectedsno
End If
Next
End If
Dim row(5) As Object
row(0) = is_sno
row(1) = ip_editbarcodeentry.Text.Trim
row(2) = ip_editpiece.Text.Trim
row(3) = is_spnrlastmeter.SelectedItem
row(4) = ip_editmeter.Text.Trim
if_flexgrid.AddRow(row, False)
Sleep(1)
if_flexgrid.SetColAlignment(0,"LEFT")
ip_editbarcodeentry.Text = ""
ip_editmeter.Text = ""
ip_editpiece.Text = ""
is_selectedsno = ""
End Sub
Private Sub if_flexgrid_CellClick(Row As Int, Col As Int)
Dim Rowdata As List = if_flexgrid.GetCellRow(Row)
is_rownumber = Row
is_selectedsno = Rowdata.Get(0)
Log("row no : " & is_rownumber)
Log("sno : " & is_selectedsno)
Dim ls_barcode As String = Rowdata.Get(1)
Dim ls_piece As String = Rowdata.Get(2)
Dim ls_lastmeter As String = Rowdata.Get(3)
Dim ls_meter As String = Rowdata.Get(4)
If ls_lastmeter == "No" Then
is_spnrlastmeter.SelectedIndex = 1
Else If ls_lastmeter == "Yes" Then
is_spnrlastmeter.SelectedIndex = 0
End If
ip_editbarcodeentry.Text = ls_barcode
ip_editpiece.Text = ls_piece
ip_editmeter.Text = ls_meter
End Sub