iOS Question SD Flexgrid

David Hawkins

Active Member
Licensed User
Longtime User
Hi I have several pages with flexgrids which work perfectly well on the first time of asking when I try to open the page again the flexgrids are all blank.

This is the code when the page appears

Flexgrid sub routine:
Private Sub B4XPage_Appear
    Try
        FlexGrid1.ClearRows

        FlexGrid1.ColsName = Array As String("ID", "Select", "User Name", "Company")
        FlexGrid1.HeaderFont = xui.CreateDefaultBoldFont(16)
        FlexGrid1.ColsWidth = Array As Int(0, 20%x, 40%x, 40%x)
        FlexGrid1.ColsType = Array As Int(FlexGrid1.TypeInt, FlexGrid1.TypeCheck, FlexGrid1.TypeString, FlexGrid1.TypeString)
        FlexGrid1.ColsAlignment = Array As String("CENTER","CENTER","LEFT","LEFT")

        GetUsers

    Catch
        Log(LastException)
    End Try
  
End Sub

And this is the code that populates the flexgrid

Populate Flexgrid:
        Dim job As HttpJob
        job.Initialize("Job1", Me)
        job.PostString(Main.URL & "GetUsers.asmx", xml)
        job.GetRequest.SetContentType("text/xml; charset=utf-8")
        job.GetRequest.SetHeader("Content-Type", "text/xml; charset=utf-8")

        wait for (job) JobDone(job As HttpJob)
          
        If job.Success Then
            Dim parser As JSONParser
            Dim response As String = job.GetString
            Dim s As String = response
            s = s.Substring2(0, s.LastIndexOf("}") + 2)
          
            parser.Initialize(s)
            Dim R As List
            R.Initialize
            R = parser.NextObject

            For Each colroot As Map In R
                FlexGrid1.AddRow2(Array As Object(colroot.Get("ID"), False, colroot.Get("UserName"), colroot.Get("Company")), 40dip, True)
            Next

        Else
            Main.Toast.ToastMessageShow("There has been an error getting list of users!", False)
        End If
      
        job.Release

As I say works perfectly first time round but not when I open the page again even though it runs through the code OK

Any ideas?

Regards

David

OK found the problem you must use 'numberdip' i.e. 150dip instead of percentage i.e. 40%x
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…