Issue with Titanium: Unable to scroll within tableview

The tableview is not scrolling as expected.

I tested it on a mobile device and the scrolling worked fine, but it doesn't seem to work on tablets.

Please assist.

CODE

var win = Titanium.UI.createWindow({
    title : 'Medall app',
    backgroundColor : '#fff',
    fullscreen : false,
    navBarHidden : true,
    layout : 'vertical',
});
var scrollView = Titanium.UI.createScrollView({
    contentWidth : 'auto',
    contentHeight : 'auto',
    width : Titanium.UI.FILL,
    height : Titanium.UI.FILL,
    top : '0dp',
    bottom : '0dp',
    layout : 'vertical',
    showVerticalScrollIndicator : true
});
win.add(scrollView);
var mainview = Titanium.UI.createView({
    width : Ti.UI.FILL,
    height : Ti.UI.FILL,
    //layout : 'horizontal',
    horizontalWrap : false,
    //right : '10dp',
    //left : '10dp',
    layout : 'vertical',
    //backgroundImage : '/images/backblue.png'
    //backgroundColor : medblue,
    backgroundColor : 'white',
    bottom : '20dp'
    //top : '20dp',
    //backgroundColor:''
});
scrollView.add(mainview);
var tableview = Titanium.UI.createTableView({
    //data : data,
    backgroundColor : 'white',
    width : '90%',
    height : 0,
    layout : 'horizontal',
    padding : '10dp',
    separatorColor : bordercolor_views_textfields,
    top : '0dp',
    borderColor : medblue,
    scrollable : true
});
mainview.add(tableview);
            var a=['1','2','3','4','5'];
            for (var i = 0; i < a.length; i++) {
                   var row = Ti.UI.createTableViewRow({
                    height : '30dp',
                    layout : 'vertical',
                    className : 'row',
                    objName : 'row',
                    onClick : "delete",
                    onPress : "rowvalue",
                    backgroundColor : 'white',
                    //rightImage : '/images/Right_Arrow',
                    top : '0dp',
                    padding : '10dp',
                    width : '100%',
                    horizontalWrap : false,
                    layout : 'horizontal',
                    backgroundColor : 'white',
                    top : '10dp',
                    padding : '10dp',
                });

                var heading_report = Titanium.UI.createView({
                    width : '48%',
                    height : Ti.UI.SIZE,
                    //layout : 'horizontal',
                    horizontalWrap : false,
                    //right : '10dp',
                    //left : '10dp',
                    layout : 'vertical',
                    //backgroundImage : '/images/backblue.png'
                    backgroundColor : 'white',
                    left : '0dp',
                    left : '1%',
                    right : '1%',
                    padding : '10dp',
                });
                row.add(heading_report);

                var heading_report_label = Ti.UI.createLabel({
                    text : a[i],
                    font : {
                        fontSize : '20dp',
                        fontWeight : 'bold'
                    },
                    color : bordercolor_views_textfields,
                    left : '0dp',
                    //left : '10dp',
                    //right : '10dp'
                    //bottom : '10dp'
                });
                heading_report.add(heading_report_label);
                var heading_status = Titanium.UI.createView({
                    width : '48%',
                    height : Ti.UI.SIZE,
                    //layout : 'horizontal',
                    horizontalWrap : false,
                    //right : '10dp',
                    //left : '10dp',
                    layout : 'absolute',
                    //backgroundImage : '/images/backblue.png'
                    backgroundColor : 'white',
                    left : '1%',
                    right : '1%',
                    padding : '10dp',
                });
                row.add(heading_status);

                var heading_status_label = Ti.UI.createLabel({
                    text : "" + a[i],
                    color : 'black',
                    font : {
                        fontSize : '20dp',
                        fontWeight : 'bold'
                    },
                    left : '0dp',

                });
                heading_status.add(heading_status_label);
                data.push(row);
                stableview.setData(data);
            }

I also tried adding this code snippet to the manifest file, but it didn't resolve the issue:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <application android:theme="@style/Theme.MyTheme">
            <supports-screens android:largeScreens="true"
                android:normalScreens="true"
                android:smallScreens="true" android:xlargeScreens="true"/>
            <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19"/>
            <uses-permission android:name="android.permission.INTERNET"/>
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        </application>
    </manifest>
</android>

Answer №1

Recently, I made some updates to the code:

var win = Titanium.UI.createWindow({
    title : 'Medall app',
    backgroundColor : '#fff',
    fullscreen : false,
    navBarHidden : true,
    layout : 'vertical',
});
var scrollView = Titanium.UI.createScrollView({
    width : Titanium.UI.FILL,
    top : '0dp',
    bottom : '0dp',
    layout : 'vertical',
    showVerticalScrollIndicator : true
});
win.add(scrollView);
var mainview = Titanium.UI.createView({
    width : Ti.UI.FILL,
    height : Ti.UI.FILL,
    layout : 'vertical',
    horizontalWrap : false,
    backgroundColor : 'white',
    bottom : '20dp'
});
scrollView.add(mainview);

var data = [];
var tableview = Titanium.UI.createTableView({
    backgroundColor : 'white',
    width : '90%',
    layout : 'horizontal',
    padding : '10dp',
    separatorColor : 'black',
    top : '0dp',
    borderColor : 'blue',
    scrollable : true
});
mainview.add(tableview);

var a=['1','2','3','4','5'];

for (var i = 0; i < a.length; i++) {
    var row = Ti.UI.createTableViewRow({
        height : '30dp',
        layout : 'vertical',
        className : 'row',
        objName : 'row',
        onClick : "delete",
        onPress : "rowvalue",
        backgroundColor : 'white',
        top : '10dp',
        padding : '10dp',
        width : '100%',
        horizontalWrap : false,
        layout : 'horizontal',
        backgroundColor : 'white',
        top : '10dp',
        padding : '10dp',
    });

    var heading_report = Titanium.UI.createView({
        width : '150dp',
        height : Ti.UI.SIZE,
        horizontalWrap : false,
        layout : 'vertical',
        backgroundColor : 'white',
        left : '0dp',
        padding : '10dp',
    });    
    row.add(heading_report);

    var heading_report_label = Ti.UI.createLabel({
        text : a[i],
        font : {
            fontSize : '20dp',
            fontWeight : 'bold'
        },
        color : 'black',
        left : '0dp',
    });
    heading_report.add(heading_report_label);
    var heading_status = Titanium.UI.createView({
        width : '48%',
        height : Ti.UI.SIZE,
        horizontalWrap : false,
        layout : 'absolute',
        backgroundColor : 'white',
        left : '1%',
        padding : '10dp',
    });
    row.add(heading_status);

    var heading_status_label = Ti.UI.createLabel({
        text : "" + a[i],
        color : 'black',
        font : {
            fontSize : '20dp',
            fontWeight : 'bold'
        },
        left : '0dp',
    });
    heading_status.add(heading_status_label);
    data.push(row);
    tableview.setData(data);
}
win.open();

The above code is now running smoothly without the need for any adjustments in the manifest tag.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Need a jQuery callback function in PHP that only retrieves the value without any redirection

Initially, I expected this task to be simple but it turns out my skills are a bit rusty. The snippet of javascript/jquery code that I am using is: $.get("plugin.php", {up_vote:surl}, function(data){ //alert(data); document.getElementById(&apo ...

Controlling the Escape Key and Clicking Outside the Material-ui Dialog Box

I am currently utilizing material-ui's dialog feature. In this setup, when a user clicks the "sign out" button, a dialog box opens with options to either confirm the sign out by selecting "yes" or cancel it by choosing "no". The issue arises when the ...

Generating VueJS Syntax from JSON Data

My goal is to retrieve locale language variables from a JSON Request generated by Laravel and load them into VueJS. VueJS does not natively support locales, so I am facing issues with the ready function alert not working while the random text data variable ...

Client-side rendering for NextJS server components is also supported

I am currently working with Material UI v5.11.16 in a nextjs environment using v13.3.0. I followed the official documentation setup for my nextjs project which can be found here. So far, I have successfully integrated Material UI components without having ...

Unable to display bar chart on PHP webpage showing database number volumes using JavaScript

I'm currently working on generating a bar chart to show the number of bookings per month. I have two separate SQL queries that retrieve the data correctly, as confirmed by testing. However, when I try to run the file in my browser, nothing is displaye ...

Ensuring the correctness of environment variables in Next.js using Zod

After spending the entire day trying to figure it out, I realize that the solution may be simpler than expected. I am currently using the well-known zod library to validate my environment variables and transform data. However, I keep encountering a persis ...

The WebView.HitTestResult method is currently only receiving <img src> elements and not <a href> elements

I am attempting to open a new window in the Android browser using "_blank". I have set up an event listener for this purpose. mWebView.getSettings().setSupportMultipleWindows(true); mWebView.setWebChromeClient(new WebChromeClient() { ...

My website code being stored in cache by Chrome (as well as other browsers)

Issue: I am facing an issue with hosting a widget on my client's website where the widget needs to be different for each page. To display the widget, the client embeds a script tag on their pages. This script is loaded on every page and the content ...

Issue with utilizing Vuejs variable in Google Maps Matrix API function

Having trouble accessing a Vue.js variable in a function using the Google Maps Matrix API. I am trying to use the Google Distance Matrix API to calculate the distance between two locations. I have declared a variable globally and changed it within a functi ...

The validation did not pass using the validate.min.js script

Hey everyone, I had this code working perfectly before but now it seems to have stopped working. Can anyone help me figure out what's going on? Below is the form I am referring to: <form action="CreateUser" method="POST" id="subscribe"> & ...

Create a POST request to the server using Express.js

I'm facing a minor problem with something I had assumed was doable. I am aiming to create two express routes – one as a GET route named /post-data and another as a POST route called /post-recieve. The code snippet would appear like the following: ...

Encountering issues with Node.js and Socket.io not displaying results on Internet Explorer when using a secure connection

I have successfully integrated socket.io, node.js, and express to serve real-time json data to multiple browsers except for IE (tested on version 9) over a secure connection. Everything was functioning smoothly until I switched to HTTPS. From the server&ap ...

Are there any available npm modules for accurately tallying the total word count within a document saved in the .doc or .doc

I Need to tally the number of words in doc/docx files stored on a server using express.js. Can anyone recommend a good package for this task? ...

Click on the window.location.href to redirect with multiple input values

I am facing a challenge with my checkboxes (from the blog label) and the code I have been using to load selected labels. However, this code seems to only work for one label. Despite multiple attempts, I have found that it only functions properly with one ...

How to bind parent object scope to MySQL query's anonymous callback in Node.js

As a newcomer to node.js, I am still working on understanding the concept of scoping anonymous functions. I have created an object with multiple methods and within one of my methods, I retrieve a MySQL connection from a pool and then execute a query on tha ...

Can a PHP script be executed through an Ajax event?

Is it feasible to execute the script of a PHP file when an AJAX event is triggered? Consider this scenario: on the AJAX error, could we send the data to the error.php file, record the error, notify the admin via email, and perform any other desired action ...

Using ng-click to manipulate variables within a list

In my ionic/angular/phonegap app, I have a list of items and I'm attempting to use an action sheet to pass in the variables. However, I am having trouble accessing the variable on the same line as the ng-repeater. Here is the markup: <ion-view vi ...

Utilizing the default event object in ag-Grid's event methods with JavaScript

I am a newcomer to ag-grid and I need help with calling event.preventDefault() in the "cellEditingStopped" grid event. Unfortunately, I am struggling to pass the default JavaScript event object into it. Is there a way to make this work? Additionally, I al ...

`What purpose does the data-view attribute serve in Durandal JS?`

While experimenting with the Durandal JS starter kit application, I happened to view the page source in Mozilla browser and noticed the following. <div class="" data-view="views/shell" style="" data-active-view="true"> </div> I couldn't ...

Express is unable to locate the specified property

Here is my controller code snippet: exports.showit = function(req, res){ res.render('showpost', { title: req.post.title, post: req.post }) } In my post model, I have included title and name objects: title: {type : String, default : &apos ...