Load list view with selected rows

I want initial listview of a doc to be loaded with some of the rows only. So, I am having frappe.call which calls method that gets data using frappe.db.sql having conditional query. This call returns proper rows. Now I want to load the listview of the doc with this result. But it is not loading.

Here is my code.

frappe.listview_settings[‘Activity Tracker’] = {
onload: function (listview) {
callback: function( r ) {
listview.data = r.message;

Where am I going wrong?

can try through hook to restrict rows visible to user, then listview need not br customised

permission_query_conditions = {
    "{doctype}": "{dotted.path.to.function}",
has_permission = {
    "{doctype}": "{dotted.path.to.function}",

yes… solved by this way before some days

dotted.path.to.function what is mean ?
can you help me i need to write script or query to show all recrods in the listview if it not has status== "final approval "

In hooks.py you have to specify the path of py file in which you with write method for listview. Path hierarchy from the app folder drilled down to py file.
i.e. Appname.Appname.doctype.docname.docname

thanks too much you help me .
can you explain any method for listview ?

You just have to specify some condition and return the list in py file

def get_details_based_permission(user):
dep_list = “(tabDepartment.status <> ‘final approval’ )”
return dep_list

and in hooks.py, specify path to above method

permission_query_conditions = {
“doctype name” : Appname.Appname.doctype.docname.docname.get_details_based_permission

thnx a lot
i will applay and feedback